Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Static Public Member Functions
Resource_Unicode Class Reference

This class provides functions used to convert a non-ASCII C string given in ANSI, EUC, GB or SJIS format, to a Unicode string of extended characters, and vice versa. More...

#include <Resource_Unicode.hxx>

Static Public Member Functions

static void ConvertSJISToUnicode (const char *const fromstr, TCollection_ExtendedString &tostr)
 Converts non-ASCII CString <fromstr> in SJIS format to Unicode ExtendedString <tostr>.
 
static void ConvertEUCToUnicode (const char *const fromstr, TCollection_ExtendedString &tostr)
 Converts non-ASCII CString <fromstr> in EUC format to Unicode ExtendedString <tostr>.
 
static void ConvertGBToUnicode (const char *const fromstr, TCollection_ExtendedString &tostr)
 Converts non-ASCII CString <fromstr> in GB format to Unicode ExtendedString <tostr>.
 
static bool ConvertGBKToUnicode (const char *const fromstr, TCollection_ExtendedString &tostr)
 Converts non-ASCII CString <fromstr> in GBK format to Unicode ExtendedString <tostr>.
 
static bool ConvertBig5ToUnicode (const char *const fromstr, TCollection_ExtendedString &tostr)
 Converts non-ASCII CString <fromstr> in Big5 format to Unicode ExtendedString <tostr>.
 
static bool ConvertUnicodeToSJIS (const TCollection_ExtendedString &fromstr, Standard_PCharacter &tostr, const int maxsize)
 Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in SJIS format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.
 
static bool ConvertUnicodeToEUC (const TCollection_ExtendedString &fromstr, Standard_PCharacter &tostr, const int maxsize)
 Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in EUC format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.
 
static bool ConvertUnicodeToGB (const TCollection_ExtendedString &fromstr, Standard_PCharacter &tostr, const int maxsize)
 Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in GB format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.
 
static bool ConvertUnicodeToANSI (const TCollection_ExtendedString &fromstr, Standard_PCharacter &tostr, const int maxsize)
 Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in ANSI format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.
 
static void SetFormat (const Resource_FormatType typecode)
 Defines the current conversion format as typecode. This conversion format will then be used by the functions ConvertFormatToUnicode and ConvertUnicodeToFormat to convert the strings.
 
static Resource_FormatType GetFormat ()
 Returns the current conversion format (either ANSI, EUC, GB or SJIS). The current converting format must be defined in advance with the SetFormat function.
 
static void ReadFormat ()
 Reads converting format from resource "FormatType" in Resource Manager "CharSet".
 
static void ConvertFormatToUnicode (const char *const theFromStr, TCollection_ExtendedString &theToStr)
 Converts the non-ASCII C string (as specified by GetFormat()) to the Unicode string of extended characters.
 
static void ConvertFormatToUnicode (const Resource_FormatType theFormat, const char *const theFromStr, TCollection_ExtendedString &theToStr)
 Converts the non-ASCII C string in specified format to the Unicode string of extended characters.
 
static bool ConvertUnicodeToFormat (const Resource_FormatType theFormat, const TCollection_ExtendedString &theFromStr, Standard_PCharacter &theToStr, const int theMaxSize)
 Converts the Unicode string of extended characters to the non-ASCII string according to specified format. You need more than twice the length of the source string to complete the conversion. The function returns true if conversion is complete, i.e. the maximum number of characters is not reached before the end of conversion.
 
static bool ConvertUnicodeToFormat (const TCollection_ExtendedString &theFromStr, Standard_PCharacter &theToStr, const int theMaxSize)
 Converts the Unicode string of extended characters to the non-ASCII string according to the format returned by the function GetFormat.
 

Detailed Description

This class provides functions used to convert a non-ASCII C string given in ANSI, EUC, GB or SJIS format, to a Unicode string of extended characters, and vice versa.

Member Function Documentation

◆ ConvertBig5ToUnicode()

static bool Resource_Unicode::ConvertBig5ToUnicode ( const char *const fromstr,
TCollection_ExtendedString & tostr )
static

Converts non-ASCII CString <fromstr> in Big5 format to Unicode ExtendedString <tostr>.

◆ ConvertEUCToUnicode()

static void Resource_Unicode::ConvertEUCToUnicode ( const char *const fromstr,
TCollection_ExtendedString & tostr )
static

Converts non-ASCII CString <fromstr> in EUC format to Unicode ExtendedString <tostr>.

◆ ConvertFormatToUnicode() [1/2]

static void Resource_Unicode::ConvertFormatToUnicode ( const char *const theFromStr,
TCollection_ExtendedString & theToStr )
inlinestatic

Converts the non-ASCII C string (as specified by GetFormat()) to the Unicode string of extended characters.

◆ ConvertFormatToUnicode() [2/2]

static void Resource_Unicode::ConvertFormatToUnicode ( const Resource_FormatType theFormat,
const char *const theFromStr,
TCollection_ExtendedString & theToStr )
static

Converts the non-ASCII C string in specified format to the Unicode string of extended characters.

Parameters
[in]theFormatsource encoding
[in]theFromStrtext to convert
[out]theToStrdestination string

◆ ConvertGBKToUnicode()

static bool Resource_Unicode::ConvertGBKToUnicode ( const char *const fromstr,
TCollection_ExtendedString & tostr )
static

Converts non-ASCII CString <fromstr> in GBK format to Unicode ExtendedString <tostr>.

◆ ConvertGBToUnicode()

static void Resource_Unicode::ConvertGBToUnicode ( const char *const fromstr,
TCollection_ExtendedString & tostr )
static

Converts non-ASCII CString <fromstr> in GB format to Unicode ExtendedString <tostr>.

◆ ConvertSJISToUnicode()

static void Resource_Unicode::ConvertSJISToUnicode ( const char *const fromstr,
TCollection_ExtendedString & tostr )
static

Converts non-ASCII CString <fromstr> in SJIS format to Unicode ExtendedString <tostr>.

◆ ConvertUnicodeToANSI()

static bool Resource_Unicode::ConvertUnicodeToANSI ( const TCollection_ExtendedString & fromstr,
Standard_PCharacter & tostr,
const int maxsize )
static

Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in ANSI format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.

◆ ConvertUnicodeToEUC()

static bool Resource_Unicode::ConvertUnicodeToEUC ( const TCollection_ExtendedString & fromstr,
Standard_PCharacter & tostr,
const int maxsize )
static

Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in EUC format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.

◆ ConvertUnicodeToFormat() [1/2]

static bool Resource_Unicode::ConvertUnicodeToFormat ( const Resource_FormatType theFormat,
const TCollection_ExtendedString & theFromStr,
Standard_PCharacter & theToStr,
const int theMaxSize )
static

Converts the Unicode string of extended characters to the non-ASCII string according to specified format. You need more than twice the length of the source string to complete the conversion. The function returns true if conversion is complete, i.e. the maximum number of characters is not reached before the end of conversion.

Parameters
[in]theFormatdestination encoding
[in]theFromStrtext to convert
[out]theToStrdestination buffer
[in]theMaxSizedestination buffer length

◆ ConvertUnicodeToFormat() [2/2]

static bool Resource_Unicode::ConvertUnicodeToFormat ( const TCollection_ExtendedString & theFromStr,
Standard_PCharacter & theToStr,
const int theMaxSize )
inlinestatic

Converts the Unicode string of extended characters to the non-ASCII string according to the format returned by the function GetFormat.

Parameters
[in]theFromStrtext to convert
[out]theToStrdestination buffer
[in]theMaxSizedestination buffer length

◆ ConvertUnicodeToGB()

static bool Resource_Unicode::ConvertUnicodeToGB ( const TCollection_ExtendedString & fromstr,
Standard_PCharacter & tostr,
const int maxsize )
static

Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in GB format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.

◆ ConvertUnicodeToSJIS()

static bool Resource_Unicode::ConvertUnicodeToSJIS ( const TCollection_ExtendedString & fromstr,
Standard_PCharacter & tostr,
const int maxsize )
static

Converts Unicode ExtendedString <fromstr> to non-ASCII CString <tostr> in SJIS format, limited to <maxsize> characters. To translate the whole <fromstr>, use more than twice the length of <fromstr>. Returns true if <maxsize> has not been reached before end of conversion.

◆ GetFormat()

static Resource_FormatType Resource_Unicode::GetFormat ( )
static

Returns the current conversion format (either ANSI, EUC, GB or SJIS). The current converting format must be defined in advance with the SetFormat function.

◆ ReadFormat()

static void Resource_Unicode::ReadFormat ( )
static

Reads converting format from resource "FormatType" in Resource Manager "CharSet".

◆ SetFormat()

static void Resource_Unicode::SetFormat ( const Resource_FormatType typecode)
static

Defines the current conversion format as typecode. This conversion format will then be used by the functions ConvertFormatToUnicode and ConvertUnicodeToFormat to convert the strings.


The documentation for this class was generated from the following file: