MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / CsConvert

Class CsConvert

src/common/CsConvert.h:40–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace Jrd {
39
40class CsConvert
41{
42public:
43 CsConvert(charset* cs1, charset* cs2)
44 : charSet1(cs1),
45 charSet2(cs2),
46 cnvt1((cs1 ? &cs1->charset_to_unicode : NULL)),
47 cnvt2((cs2 ? &cs2->charset_from_unicode : NULL))
48 {
49 if (cs1 == NULL)
50 {
51 charSet1 = cs2;
52 cnvt1 = cnvt2;
53
54 charSet2 = NULL;
55 cnvt2 = NULL;
56 }
57 }
58
59 CsConvert(const CsConvert& obj)
60 : charSet1(obj.charSet1),
61 charSet2(obj.charSet2),
62 cnvt1(obj.cnvt1),
63 cnvt2(obj.cnvt2)
64 {
65 }
66
67 void convert(ULONG srcLen,
68 const UCHAR* src,
69 Firebird::UCharBuffer& dst,
70 ULONG* badInputPos = NULL,
71 bool ignoreTrailingSpaces = false)
72 {
73 dst.getBuffer(convertLength(srcLen));
74 dst.resize(convert(srcLen, src, (ULONG) dst.getCapacity(), dst.begin(), badInputPos, ignoreTrailingSpaces));
75 }
76
77 // CVC: Beware of this can of worms: csconvert_convert gets assigned
78 // different functions that not necessarily take the same argument. Typically,
79 // the src pointer and the dest pointer use different types.
80 // How does this work without crashing is a miracle of IT.
81
82 // To be used with getConvFromUnicode method of CharSet class
83 ULONG convert(ULONG srcLen,
84 const USHORT* src,
85 ULONG dstLen,
86 UCHAR* dst,
87 ULONG* badInputPos = NULL,
88 bool ignoreTrailingSpaces = false)
89 {
90 return convert(srcLen, reinterpret_cast<const UCHAR*>(src), dstLen, dst, badInputPos, ignoreTrailingSpaces);
91 }
92
93 // To be used with getConvToUnicode method of CharSet class
94 ULONG convert(ULONG srcLen,
95 const UCHAR* src,
96 ULONG dstLen, // Beware: in bytes, not in characters
97 USHORT* dst,

Callers 3

lookupConverterMethod · 0.85
getConvToUnicodeMethod · 0.85
getConvFromUnicodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected