2002-06-04 21:36:48 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: JRD International support
|
|
|
|
* MODULE: intl_classes.h
|
|
|
|
* DESCRIPTION: International text handling definitions
|
|
|
|
*
|
2003-12-27 05:37:23 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
* You may obtain a copy of the Licence at
|
|
|
|
* http://www.gnu.org/licences/lgpl.html
|
|
|
|
*
|
|
|
|
* As a special exception this file can also be included in modules
|
|
|
|
* with other source code as long as that source code has been
|
|
|
|
* released under an Open Source Initiative certificed licence.
|
|
|
|
* More information about OSI certification can be found at:
|
|
|
|
* http://www.opensource.org
|
|
|
|
*
|
|
|
|
* This module is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public Licence for more details.
|
|
|
|
*
|
|
|
|
* This module was created by members of the firebird development
|
|
|
|
* team. All individual contributions remain the Copyright (C) of
|
|
|
|
* those individuals and all rights are reserved. Contributors to
|
|
|
|
* this file are either listed below or can be obtained from a CVS
|
|
|
|
* history command.
|
2002-06-04 21:36:48 +02:00
|
|
|
*
|
2003-12-27 05:37:23 +01:00
|
|
|
* Created by: Nickolay Samofatov <skidder@bssys.com>
|
2002-06-04 21:36:48 +02:00
|
|
|
*
|
2003-12-27 05:37:23 +01:00
|
|
|
* Contributor(s):
|
2002-06-04 21:36:48 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-10-03 03:53:34 +02:00
|
|
|
#ifndef JRD_INTL_CLASSES_H
|
|
|
|
#define JRD_INTL_CLASSES_H
|
2002-06-04 21:36:48 +02:00
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
#include "firebird.h"
|
|
|
|
#include "../jrd/jrd.h"
|
|
|
|
#include "../jrd/constants.h"
|
|
|
|
#include "../jrd/intlobj.h"
|
2002-06-04 21:36:48 +02:00
|
|
|
|
|
|
|
class TextType
|
|
|
|
{
|
|
|
|
public:
|
2003-12-27 05:37:23 +01:00
|
|
|
typedef bool (*FPTR_CONTAINS)(TDBB tdbb, TextType ttype, const UCHAR* s, SSHORT ls, const UCHAR* p, SSHORT lp);
|
|
|
|
typedef void* (*FPTR_CONTAINS_CREATE)(TDBB tdbb, TextType ttype, const UCHAR* p, SSHORT lp);
|
|
|
|
typedef void (*FPTR_CONTAINS_DESTROY)(void* object);
|
|
|
|
typedef void (*FPTR_CONTAINS_RESET)(void* object);
|
|
|
|
typedef bool (*FPTR_CONTAINS_PROCESS)(TDBB tdbb, TextType ttype, void* object, const UCHAR* s, SSHORT ls);
|
|
|
|
typedef bool (*FPTR_CONTAINS_RESULT)(void* object);
|
|
|
|
|
|
|
|
typedef bool (*FPTR_LIKE)(TDBB tdbb, TextType ttype, const UCHAR* s, SSHORT ls, const UCHAR* p, SSHORT lp, UCS2_CHAR escape);
|
|
|
|
typedef void* (*FPTR_LIKE_CREATE)(TDBB tdbb, TextType ttype, const UCHAR* p, SSHORT lp, UCS2_CHAR escape);
|
|
|
|
typedef void (*FPTR_LIKE_DESTROY)(void* object);
|
|
|
|
typedef void (*FPTR_LIKE_RESET)(void* object);
|
|
|
|
typedef bool (*FPTR_LIKE_PROCESS)(TDBB tdbb, TextType ttype, void* object, const UCHAR* s, SSHORT ls);
|
|
|
|
typedef bool (*FPTR_LIKE_RESULT)(void* object);
|
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
TextType(struct texttype *_tt) : tt(_tt) {}
|
|
|
|
|
|
|
|
// copy constructor
|
2003-11-03 21:16:03 +01:00
|
|
|
TextType(const TextType& obj) : tt(obj.tt) {}
|
2003-11-03 18:14:45 +01:00
|
|
|
|
|
|
|
USHORT key_length(USHORT a) {
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_key_length);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast<USHORT (*)(TEXTTYPE,USHORT)>
|
|
|
|
(tt->texttype_fn_key_length)))(tt,a);
|
|
|
|
}
|
|
|
|
|
|
|
|
USHORT string_to_key(USHORT a,
|
2003-11-05 10:02:33 +01:00
|
|
|
const UCHAR *b,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT c,
|
|
|
|
UCHAR *d,
|
|
|
|
USHORT e)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_string_to_key);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast
|
2003-11-05 10:02:33 +01:00
|
|
|
<USHORT(*)(TEXTTYPE,USHORT,const UCHAR*,USHORT,UCHAR*,USHORT)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_string_to_key)))
|
|
|
|
(tt,a,b,c,d,e);
|
|
|
|
}
|
|
|
|
|
|
|
|
SSHORT compare(USHORT a,
|
|
|
|
UCHAR *b,
|
|
|
|
USHORT c,
|
|
|
|
UCHAR *d)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_compare);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast
|
|
|
|
<short (*)(TEXTTYPE,USHORT,UCHAR*,USHORT,UCHAR*)>
|
|
|
|
(tt->texttype_fn_compare)))(tt,a,b,c,d);
|
|
|
|
}
|
|
|
|
|
|
|
|
USHORT to_upper(USHORT a)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_to_upper);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast
|
|
|
|
<short (*)(TEXTTYPE,USHORT)>
|
|
|
|
(tt->texttype_fn_to_upper)))(tt,a);
|
|
|
|
}
|
|
|
|
|
|
|
|
USHORT to_lower(USHORT a)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_to_lower);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast
|
|
|
|
<USHORT (*)(TEXTTYPE,USHORT)>
|
|
|
|
(tt->texttype_fn_to_lower)))(tt,a);
|
|
|
|
}
|
|
|
|
|
|
|
|
SSHORT str_to_upper(USHORT a,
|
2003-12-27 05:37:23 +01:00
|
|
|
const UCHAR *b,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT c,
|
|
|
|
UCHAR *d)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_str_to_upper);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast
|
2003-12-27 05:37:23 +01:00
|
|
|
<short (*)(TEXTTYPE,USHORT,const UCHAR*,USHORT,UCHAR*)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_str_to_upper)))
|
|
|
|
(tt,a,b,c,d);
|
|
|
|
}
|
|
|
|
|
|
|
|
USHORT to_wc(UCS2_CHAR *a,
|
|
|
|
USHORT b,
|
2003-12-11 11:33:30 +01:00
|
|
|
const UCHAR *c,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT d,
|
|
|
|
SSHORT *e,
|
|
|
|
USHORT *f)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_to_wc);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast
|
2003-12-11 11:33:30 +01:00
|
|
|
<USHORT (*)(TEXTTYPE,UCS2_CHAR*,USHORT,const UCHAR*,USHORT,short*,USHORT*)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_to_wc)))
|
|
|
|
(tt,a,b,c,d,e,f);
|
|
|
|
}
|
|
|
|
|
2003-12-11 11:33:30 +01:00
|
|
|
USHORT mbtowc(UCS2_CHAR* a, const UCHAR* b, USHORT c)
|
2003-11-03 18:14:45 +01:00
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_mbtowc);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast<
|
2003-12-11 11:33:30 +01:00
|
|
|
USHORT (*)(TEXTTYPE, UCS2_CHAR*, const UCHAR*, USHORT)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_mbtowc)))(tt,a,b,c);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
bool like(struct tdbb* tdbb, const UCHAR* s, SSHORT sl, const UCHAR* p, SSHORT pl, SSHORT escape)
|
2003-12-27 05:37:23 +01:00
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_like);
|
|
|
|
return reinterpret_cast<FPTR_LIKE>(tt->texttype_fn_like)(tdbb,tt,s,sl,p,pl,escape);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
void *like_create(struct tdbb* tdbb, const UCHAR* p, SSHORT pl, SSHORT escape)
|
2003-12-27 05:37:23 +01:00
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_like_create);
|
|
|
|
return reinterpret_cast<FPTR_LIKE_CREATE>(tt->texttype_fn_like_create)(tdbb,tt,p,pl,escape);
|
|
|
|
}
|
|
|
|
|
|
|
|
void like_reset(void* object)
|
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_like_reset);
|
|
|
|
reinterpret_cast<FPTR_LIKE_RESET>(tt->texttype_fn_like_reset)(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool like_result(void* object)
|
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_like_result);
|
|
|
|
return reinterpret_cast<FPTR_LIKE_RESULT>(tt->texttype_fn_like_result)(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
void like_destroy(void* object)
|
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_like_destroy);
|
|
|
|
reinterpret_cast<FPTR_LIKE_DESTROY>(tt->texttype_fn_like_destroy)(object);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
bool like_process(struct tdbb* tdbb, void* object, const UCHAR* s, SSHORT sl)
|
2003-12-27 05:37:23 +01:00
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_like_process);
|
|
|
|
return reinterpret_cast<FPTR_LIKE_PROCESS>(tt->texttype_fn_like_process)(tdbb,tt,object,s,sl);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
bool contains(struct tdbb* tdbb, const UCHAR* s, SSHORT sl, const UCHAR* p, SSHORT pl)
|
2003-11-03 18:14:45 +01:00
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_contains);
|
2003-12-27 05:37:23 +01:00
|
|
|
return reinterpret_cast<FPTR_CONTAINS>(tt->texttype_fn_contains)(tdbb,tt,s,sl,p,pl);
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
void *contains_create(struct tdbb* tdbb, const UCHAR* p, SSHORT pl)
|
2003-11-03 18:14:45 +01:00
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
2003-12-27 05:37:23 +01:00
|
|
|
fb_assert(tt->texttype_fn_contains_create);
|
|
|
|
return reinterpret_cast<FPTR_CONTAINS_CREATE>(tt->texttype_fn_contains_create)(tdbb,tt,p,pl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void contains_reset(void* object)
|
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_contains_reset);
|
|
|
|
reinterpret_cast<FPTR_CONTAINS_RESET>(tt->texttype_fn_contains_reset)(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool contains_result(void* object)
|
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_contains_result);
|
|
|
|
return reinterpret_cast<FPTR_CONTAINS_RESULT>(tt->texttype_fn_contains_result)(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
void contains_destroy(void* object)
|
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_contains_destroy);
|
|
|
|
reinterpret_cast<FPTR_CONTAINS_DESTROY>(tt->texttype_fn_contains_destroy)(object);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
bool contains_process(struct tdbb* tdbb, void* object, const UCHAR* s, SSHORT sl)
|
2003-12-27 05:37:23 +01:00
|
|
|
{
|
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_contains_process);
|
|
|
|
return reinterpret_cast<FPTR_CONTAINS_PROCESS>(tt->texttype_fn_contains_process)(tdbb,tt,object,s,sl);
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
USHORT matches(struct tdbb* tdbb, const UCHAR* a, SSHORT b, const UCHAR* c, SSHORT d)
|
2003-11-03 18:14:45 +01:00
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_matches);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast<
|
2004-02-20 07:43:27 +01:00
|
|
|
USHORT (*)(struct tdbb*, TextType, const UCHAR*, short, const UCHAR*, short)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_matches)))
|
|
|
|
(tdbb,tt,a,b,c,d);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
USHORT sleuth_check(struct tdbb* tdbb, USHORT a,
|
2003-12-11 11:33:30 +01:00
|
|
|
const UCHAR* b,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT c,
|
2003-12-11 11:33:30 +01:00
|
|
|
const UCHAR* d,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT e)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_sleuth_check);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast<
|
2004-02-20 07:43:27 +01:00
|
|
|
USHORT(*)(struct tdbb*, TextType, USHORT, const UCHAR*, USHORT, const UCHAR*, USHORT)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_sleuth_check)))
|
|
|
|
(tdbb,tt,a,b,c,d,e);
|
|
|
|
}
|
|
|
|
|
2004-02-20 07:43:27 +01:00
|
|
|
USHORT sleuth_merge(struct tdbb* tdbb, const UCHAR* a,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT b,
|
2003-12-11 11:33:30 +01:00
|
|
|
const UCHAR* c,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT d,
|
2003-12-11 11:33:30 +01:00
|
|
|
UCHAR* e,
|
2003-11-03 18:14:45 +01:00
|
|
|
USHORT f)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
|
|
|
fb_assert(tt->texttype_fn_sleuth_merge);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast<
|
2004-02-20 07:43:27 +01:00
|
|
|
USHORT(*)(struct tdbb*, TextType, const UCHAR*, USHORT, const UCHAR*, USHORT, UCHAR*, USHORT)>
|
2003-11-03 18:14:45 +01:00
|
|
|
(tt->texttype_fn_sleuth_merge)))
|
|
|
|
(tdbb,tt,a,b,c,d,e,f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
USHORT getType() const {
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
2003-11-03 18:14:45 +01:00
|
|
|
return tt->texttype_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *getName() const {
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
2003-11-03 18:14:45 +01:00
|
|
|
return tt->texttype_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
CHARSET_ID getCharSet() const {
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
2003-11-03 18:14:45 +01:00
|
|
|
return tt->texttype_character_set;
|
|
|
|
}
|
|
|
|
|
|
|
|
SSHORT getCountry() const {
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
2003-11-03 18:14:45 +01:00
|
|
|
return tt->texttype_country;
|
|
|
|
}
|
|
|
|
|
|
|
|
UCHAR getBytesPerChar() const {
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(tt);
|
2003-11-03 18:14:45 +01:00
|
|
|
return tt->texttype_bytes_per_char;
|
|
|
|
}
|
2003-11-03 21:16:03 +01:00
|
|
|
|
|
|
|
struct texttype *getStruct() const { return tt; }
|
2003-11-03 18:14:45 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct texttype *tt;
|
2002-06-04 21:36:48 +02:00
|
|
|
};
|
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
static inline bool operator ==(const TextType& tt1, const TextType& tt2) {
|
2003-11-03 21:16:03 +01:00
|
|
|
return tt1.getStruct() == tt2.getStruct();
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
2002-06-04 21:36:48 +02:00
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
static inline bool operator !=(const TextType& tt1, const TextType& tt2) {
|
2003-11-03 21:16:03 +01:00
|
|
|
return tt1.getStruct() != tt2.getStruct();
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
2002-06-04 21:36:48 +02:00
|
|
|
|
|
|
|
class CsConvert
|
|
|
|
{
|
|
|
|
public:
|
2003-11-03 18:14:45 +01:00
|
|
|
CsConvert(struct csconvert *_cnvt) : cnvt(_cnvt) {}
|
2003-11-03 21:16:03 +01:00
|
|
|
CsConvert(const CsConvert& obj) : cnvt(obj.cnvt) {}
|
2003-11-03 18:14:45 +01:00
|
|
|
|
|
|
|
USHORT convert(UCHAR *a,
|
|
|
|
USHORT b,
|
|
|
|
UCHAR *c,
|
|
|
|
USHORT d,
|
|
|
|
SSHORT *e,
|
|
|
|
USHORT *f)
|
|
|
|
{
|
2003-11-04 00:59:24 +01:00
|
|
|
fb_assert(cnvt != NULL);
|
2003-11-03 18:14:45 +01:00
|
|
|
return (*(reinterpret_cast<USHORT (*)(struct csconvert*, UCHAR*,USHORT,
|
|
|
|
UCHAR*,USHORT,short*,USHORT*)>(cnvt->csconvert_convert)))
|
|
|
|
(cnvt,a,b,c,d,e,f);
|
|
|
|
}
|
|
|
|
|
2003-11-04 00:59:24 +01:00
|
|
|
SSHORT getId() const { fb_assert(cnvt); return cnvt->csconvert_id; }
|
|
|
|
const char *getName() const { fb_assert(cnvt); return cnvt->csconvert_name; }
|
|
|
|
CHARSET_ID getFromCS() const { fb_assert(cnvt); return cnvt->csconvert_from; }
|
|
|
|
CHARSET_ID getToCS() const { fb_assert(cnvt); return cnvt->csconvert_to; }
|
2003-11-03 21:16:03 +01:00
|
|
|
|
|
|
|
struct csconvert *getStruct() const { return cnvt; }
|
2003-11-04 00:59:24 +01:00
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
private:
|
|
|
|
struct csconvert *cnvt;
|
2002-06-04 21:36:48 +02:00
|
|
|
};
|
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
static inline bool operator ==(const CsConvert& cv1, const CsConvert& cv2) {
|
2003-11-03 21:16:03 +01:00
|
|
|
return cv1.getStruct() == cv2.getStruct();
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
2002-06-04 21:36:48 +02:00
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
static inline bool operator !=(const CsConvert& cv1, const CsConvert& cv2) {
|
2003-11-03 21:16:03 +01:00
|
|
|
return cv1.getStruct() != cv2.getStruct();
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
2002-06-04 21:36:48 +02:00
|
|
|
|
|
|
|
class CharSet
|
|
|
|
{
|
|
|
|
public:
|
2003-11-03 18:14:45 +01:00
|
|
|
CharSet(struct charset *_cs) : cs(_cs) {}
|
2003-11-03 21:16:03 +01:00
|
|
|
CharSet(const CharSet &obj) : cs(obj.cs) {};
|
2003-11-03 18:14:45 +01:00
|
|
|
|
2003-11-04 00:59:24 +01:00
|
|
|
CHARSET_ID getId() const { fb_assert(cs); return cs->charset_id; }
|
|
|
|
const char *getName() const { fb_assert(cs); return cs->charset_name; }
|
|
|
|
UCHAR minBytesPerChar() const { fb_assert(cs); return cs->charset_min_bytes_per_char; }
|
|
|
|
UCHAR maxBytesPerChar() const { fb_assert(cs); return cs->charset_max_bytes_per_char; }
|
|
|
|
UCHAR getSpaceLength() const { fb_assert(cs); return cs->charset_space_length; }
|
|
|
|
const UCHAR *getSpace() const { fb_assert(cs); return cs->charset_space_character; }
|
2003-11-03 18:14:45 +01:00
|
|
|
|
2003-11-04 00:59:24 +01:00
|
|
|
CsConvert getConvToUnicode() { fb_assert(cs); return &cs->charset_to_unicode; }
|
2003-11-03 21:16:03 +01:00
|
|
|
|
2003-11-04 00:59:24 +01:00
|
|
|
CsConvert getConvFromUnicode() { fb_assert(cs); return &cs->charset_from_unicode; }
|
2003-11-03 21:16:03 +01:00
|
|
|
|
|
|
|
struct charset *getStruct() const { return cs; }
|
2003-11-04 00:59:24 +01:00
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
private:
|
|
|
|
struct charset *cs;
|
2002-06-04 21:36:48 +02:00
|
|
|
};
|
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
static inline bool operator ==(const CharSet& cs1, const CharSet& cs2) {
|
2003-11-03 21:16:03 +01:00
|
|
|
return cs1.getStruct() == cs2.getStruct();
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
2002-06-04 21:36:48 +02:00
|
|
|
|
2003-11-03 18:14:45 +01:00
|
|
|
static inline bool operator !=(const CharSet& cs1, const CharSet& cs2) {
|
2003-11-03 21:16:03 +01:00
|
|
|
return cs1.getStruct() != cs2.getStruct();
|
2003-11-03 18:14:45 +01:00
|
|
|
}
|
2002-06-04 21:36:48 +02:00
|
|
|
|
2003-10-03 03:53:34 +02:00
|
|
|
#endif /* JRD_INTL_CLASSES_H */
|
2003-11-05 10:02:33 +01:00
|
|
|
|