Foxit PDF Conversion SDK

Classes | Macros | Typedefs | Functions
fx_string.h File Reference

Header file for Strings, variable-length sequence of characters. There are two strings here, byte-string and wide-string. More...

Go to the source code of this file.

## Classes
class | CFX_ByteString
| BYTE STRING CLASS. More...
class | CFX_ByteStringC
| CONSTANT BYTE STRING CLASS. More...
class | CFX_StringBufBase
| A fixed string buffer holding up to certain number of characters. More...
class | CFX_StringBufTemplate< limit >
| A fixed string buffer template. More...
struct | CFX_StringData
| This class represents the data of a byte string object. More...
struct | CFX_StringDataW
| This class represents the data of a wide string object. More...
class | CFX_WideString
| WIDE STRING CLASS. More...
class | CFX_WideStringC
| CONSTANT WIDE STRING CLASS. More...

## Macros
#define | FX_BSTRC(str) CFX_ByteStringC(str, sizeof str-1)
| All application should use the following macro when specifying a string constant. "str" must be a character string constant. More...
#define | FX_WSTRC(wstr) CFX_WideStringC((FX_LPCWSTR)wstr, sizeof(wstr) / sizeof(FX_WCHAR) - 1)
| All application should use the following macro when specifying a wide string constant. "wstr" must be a wide string constant. More...
#define | FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4))
| Construct a ID from four integer values.
#define | FXFORMAT_CAPITAL 4
| For formating integer: using with FXFORMAT_HEX to produce capital hexadecimal letters.
#define | FXFORMAT_HEX 2
| For formating integer: using hexadecimal format.
#define | FXFORMAT_SIGNED 1
| For formating integer: the value is signed.
text direction defines
#define | FXWCHAR_LTR 0
| Left to right order.
#define | FXWCHAR_RTL 1
| Right to left order.
#define | FXWCHAR_UNKNOWN 2
| Not sure about the order or don't care.

## Typedefs
typedef CFX_StringBufTemplate< 256 > | CFX_StringBuf256
| A fixed 256-byte string buffer.
typedef const CFX_ByteStringC & | FX_BSTR
| A reference to a constant CFX_ByteStringC object.
typedef int | FX_STRSIZE
| String size is limited to 2^31-1.
typedef const CFX_WideStringC & | FX_WSTR
| Type definition for a reference to a constant CFX_WideStringC object.

## Functions
FX_FLOAT | FX_atof (FX_BSTR str)
| Convert a non-buffered byte string to a floating-point number. More...
void | FX_atonum (FX_BSTR str, FX_BOOL &bInteger, void *pData, int sizeOfData=4)
| Convert a non-buffered byte string to a number. More...
FX_STRSIZE | FX_ftoa (FX_FLOAT f, FX_LPSTR buf, int precision=0)
| Convert float to byte string. More...
int | FXWCHAR_GetDirection (FX_WCHAR wchar)
| Get text direction. More...
Byte string concatenation operation
Both side of the concatenation operator (+) can be: A buffered byte string (const CFX_ByteString&); A non-buffered byte string (const CFX_ByteStringC&, a.k.a FX_BSTR); A zero-terminated C-style string (FX_LPCSTR); A single character or byte (FX_CHAR);
CFX_ByteString | operator+ (FX_BSTR str1, FX_BSTR str2)
| Concatenate a non-buffered byte string and a non-buffered byte string. More...
CFX_ByteString | operator+ (FX_BSTR str1, FX_LPCSTR str2)
| Concatenate a non-buffered byte string and a zero-terminated C-style string. More...
CFX_ByteString | operator+ (FX_LPCSTR str1, FX_BSTR str2)
| Concatenate a zero-terminated C-style string and a non-buffered byte string. More...
CFX_ByteString | operator+ (FX_BSTR str1, FX_CHAR ch)
| Concatenate a non-buffered byte string and a single character or byte. More...
CFX_ByteString | operator+ (FX_CHAR ch, FX_BSTR str2)
| Concatenate a single character or byte and a non-buffered byte string. More...
CFX_ByteString | operator+ (const CFX_ByteString &str1, const CFX_ByteString &str2)
| Concatenate a buffered byte string and a buffered byte string. More...
CFX_ByteString | operator+ (const CFX_ByteString &str1, FX_CHAR ch)
| Concatenate a buffered byte string and a single character or byte. More...
CFX_ByteString | operator+ (FX_CHAR ch, const CFX_ByteString &str2)
| Concatenate a single character or byte and a buffered byte string. More...
CFX_ByteString | operator+ (const CFX_ByteString &str1, FX_LPCSTR str2)
| Concatenate a buffered byte string and a zero-terminated C-style string. More...
CFX_ByteString | operator+ (FX_LPCSTR str1, const CFX_ByteString &str2)
| Concatenate a zero-terminated C-style string and a buffered byte string. More...
CFX_ByteString | operator+ (const CFX_ByteString &str1, FX_BSTR str2)
| Concatenate a buffered byte string and a non-buffered byte string. More...
CFX_ByteString | operator+ (FX_BSTR str1, const CFX_ByteString &str2)
| Concatenate a non-buffered byte string and a buffered byte string. More...
Wide string concatenation operation
Both side of the concatenation operator (+) can be: A buffered wide string (const CFX_WideString&); A non-buffered wide string (const CFX_WideStringC&); A zero-terminated C-style wide string (FX_LPCWSTR); A single character (FX_WCHAR); But you must have at least one CFX_WideString or CFX_WideStringC on one side.
CFX_WideString | operator+ (const CFX_WideStringC &str1, const CFX_WideStringC &str2)
| Concatenate a non-buffered wide string and a non-buffered wide string. More...
CFX_WideString | operator+ (const CFX_WideStringC &str1, FX_LPCWSTR str2)
| Concatenate a non-buffered byte string and a zero-terminated C-style string. More...
CFX_WideString | operator+ (FX_LPCWSTR str1, const CFX_WideStringC &str2)
| Concatenate a zero-terminated C-style string and a non-buffered byte string. More...
CFX_WideString | operator+ (const CFX_WideStringC &str1, FX_WCHAR ch)
| Concatenate a non-buffered byte string and a single character or byte. More...
CFX_WideString | operator+ (FX_WCHAR ch, const CFX_WideStringC &str2)
| Concatenate a single character or byte and a non-buffered byte string. More...
CFX_WideString | operator+ (const CFX_WideString &str1, const CFX_WideString &str2)
| Concatenate a buffered byte string and a buffered byte string. More...
CFX_WideString | operator+ (const CFX_WideString &str1, FX_WCHAR ch)
| Concatenate a buffered byte string and a single character or byte. More...
CFX_WideString | operator+ (FX_WCHAR ch, const CFX_WideString &str2)
| Concatenate a single character or byte and a buffered byte string. More...
CFX_WideString | operator+ (const CFX_WideString &str1, FX_LPCWSTR str2)
| Concatenate a buffered wide string and a zero-terminated C-style string. More...
CFX_WideString | operator+ (FX_LPCWSTR str1, const CFX_WideString &str2)
| Concatenate a zero-terminated C-style string and a buffered byte string. More...
CFX_WideString | operator+ (const CFX_WideString &str1, const CFX_WideStringC &str2)
| Concatenate a buffered byte string and a non-buffered byte string. More...
CFX_WideString | operator+ (const CFX_WideStringC &str1, const CFX_WideString &str2)
| Concatenate a non-buffered byte string and a buffered byte string. More...
Wide string compare operation
bool | operator== (const CFX_WideString &s1, const CFX_WideString &s2)
| Comparison(==) operator overload. Case-sensitive. More...
bool | operator== (const CFX_WideString &s1, const CFX_WideStringC &s2)
| Comparison(==) operator overload. Case-sensitive. More...
bool | operator== (const CFX_WideStringC &s1, const CFX_WideString &s2)
| Comparison(==) operator overload. Case-sensitive. More...
bool | operator== (const CFX_WideString &s1, FX_LPCWSTR s2)
| Comparison(==) operator overload. Case-sensitive. More...
bool | operator== (FX_LPCWSTR s1, const CFX_WideString &s2)
| Comparison(==) operator overload. Case-sensitive. More...
bool | operator!= (const CFX_WideString &s1, const CFX_WideString &s2)
| Comparison(!=) operator overload. Case-sensitive. More...
bool | operator!= (const CFX_WideString &s1, const CFX_WideStringC &s2)
| Comparison(!=) operator overload. Case-sensitive. More...
bool | operator!= (const CFX_WideStringC &s1, const CFX_WideString &s2)
| Comparison(!=) operator overload. Case-sensitive. More...
bool | operator!= (const CFX_WideString &s1, FX_LPCWSTR s2)
| Comparison(!=) operator overload. Case-sensitive. More...
bool | operator!= (FX_LPCWSTR s1, const CFX_WideString &s2)
| Comparison(!=) operator overload. Case-sensitive. More...
bool | operator< (const CFX_WideString &lhs, const CFX_WideString &rhs)
| Comparison(<) operator overload. Case-sensitive. More...
Basic Unicode character attribute routines
FX_WCHAR | FXWCHAR_GetUpper (FX_WCHAR wchar)
| Convert to upper-case letter. More...
FX_WCHAR | FXWCHAR_GetLower (FX_WCHAR wchar)
| Convert to lower-case letter. More...
FX_BOOL | FXWCHAR_IsWordBreak (FX_WCHAR wchar)
| Check if the unicode can break a word. More...
FX_BOOL | FXWCHAR_IsSpace (FX_WCHAR wchar)
| Check if the unicode is space. More...
Encode wide string into UTF-8 byte string
CFX_ByteString | FX_UTF8Encode (FX_LPCWSTR pwsStr, FX_STRSIZE len)
| Encode a wide string into a UTF-8 string. More...
CFX_ByteString | FX_UTF8Encode (FX_WSTR wsStr)
| Encode a wide string into a UTF-8 string. More...
CFX_ByteString | FX_UTF8Encode (const CFX_WideString &wsStr)
| Encode a wide string into a UTF-8 string. More...
FX_BOOL | FX_IsUtf16SurrogatePair (FX_WCHAR first, FX_WCHAR second)
| Determines if the arguments constitute UTF-16 surrogate pair. More...
FX_DWORD | FX_CreateCodePointFromUtf16SurrogatePair (FX_WCHAR first, FX_WCHAR second)
| Creates a Unicode code point from UTF16 surrogate pair. More...
FX_BOOL | FX_CreateUtf16SurrogatePairFromCodePoint (FX_DWORD unicode, FX_WCHAR &first, FX_WCHAR &second)
| Creates UTF16 surrogate pair from a Unicode code point. More...

## Detailed Description

Header file for Strings, variable-length sequence of characters. There are two strings here, byte-string and wide-string.

Copyright (C) 2003-2026, Foxit Software Inc.. All Rights Reserved.

http://www.foxitsoftware.com

The following code is copyrighted and is the proprietary of Foxit Software Inc.. It is not allowed to distribute any parts of Foxit PDF SDK to third party or public without permission unless an agreement is signed between Foxit Software Inc. and customers to explicitly grant customers permissions.

## Function Documentation

## ◆ FX_CreateCodePointFromUtf16SurrogatePair()

FX_DWORD FX_CreateCodePointFromUtf16SurrogatePair | ( | FX_WCHAR | first,
|  | FX_WCHAR | second
| ) |  |
| inline

Creates a Unicode code point from UTF16 surrogate pair.

Parameters

  [in] | first | First value of a UTF16 surrogate pair.
  [in] | second | Second value of a UTF16 surrogate pair.

Returns
  The Unicode code point.

Note
  Only make sense if the the system uses UTF-16 for wide string encoding. All supported systems with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.

## ◆ FX_CreateUtf16SurrogatePairFromCodePoint()

FX_BOOL FX_CreateUtf16SurrogatePairFromCodePoint | ( | FX_DWORD | unicode,
|  | FX_WCHAR & | first,
|  | FX_WCHAR & | second
| ) |  |
| inline

Creates UTF16 surrogate pair from a Unicode code point.

Parameters

  [in] | unicode | The Unicode code point.
  [out] | first | First value of a UTF16 surrogate pair.
  [out] | second | Second value of a UTF16 surrogate pair.

Returns
  false means the Unicode code point isn't in the range which need use TF16 surrogate pair.

Note
  Only make sense if the system uses UTF-16 for wide string encoding. All supported systems with 16 bit wchar_t (Windows, Cygwin, Symbian OS) to use UTF-16.

## ◆ FX_IsUtf16SurrogatePair()

FX_BOOL FX_IsUtf16SurrogatePair | ( | FX_WCHAR | first,
|  | FX_WCHAR | second
| ) |  |
| inline

Determines if the arguments constitute UTF-16 surrogate pair.

Parameters

  [in] | first | First value of a UTF16 surrogate pair.
  [in] | second | Second value of a UTF16 surrogate pair.

Returns
  true means the arguments constitute UTF-16 surrogate pair and thus should be combined into a single Unicode code point.

Note
  Only make sense if the the system uses UTF-16 for wide string encoding. All supported systems with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.

## ◆ FX_UTF8Encode() [1/3]

CFX_ByteString FX_UTF8Encode | ( | FX_LPCWSTR | pwsStr,
|  | FX_STRSIZE | len
| ) |  |

Encode a wide string into a UTF-8 string.

Parameters

  [in] | pwsStr | Pointer to a wide string buffer.
  [in] | len | Length of wide string, in wide characters (FX_WCHAR).

Returns
  The object of encoded UTF-8 string.

## ◆ FX_UTF8Encode() [2/3]

CFX_ByteString FX_UTF8Encode | ( | FX_WSTR | wsStr | ) |
| inline

Encode a wide string into a UTF-8 string.

Parameters

  [in] | wsStr | A constant wide string.

Returns
  The object of encoded UTF-8 string.

## ◆ FX_UTF8Encode() [3/3]

CFX_ByteString FX_UTF8Encode | ( | const CFX_WideString & | wsStr | ) |
| inline

Encode a wide string into a UTF-8 string.

Parameters

  [in] | wsStr | A wide string.

Returns
  The object of encoded UTF-8 string.