Rhino C++ API  8.5
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ON_Big5CodePoint Class Reference

ON_Big5CodePoint is a tool to use when working with BIG5 encoded strings. More...

#include <opennurbs_unicode.h>

Public Types

enum  : unsigned int {
  MinimumCodePoint = 0x8140, MinimumPrivateUseCodePoint = 0x8140, MinimumStandardCodePoint = 0x8140, MaximumStandardCodePoint = 0xF9D5,
  MaximumPrivateUseCodePoint = 0xFEFE, MaximumCodePoint = 0xFEFE
}
 

Public Member Functions

 ON_Big5CodePoint ()=default
 
 ON_Big5CodePoint (const ON_Big5CodePoint &)=default
 
 ~ON_Big5CodePoint ()=default
 
unsigned int Big5CodePoint () const
 
int Encode (char *buffer, size_t buffer_capacity) const
 
bool IsASCII (bool bNullIsASCII) const
 Strictly speaking, BIG5 does not extend ASCII, but it is common to mix single bytes ASCII and double byte BIG5 encodings in the same char string. BIG5 is a double byte string encoding with the first byte in the range 0x81 to 0xFE, the minimum BIG5 code point is 0x8140 and the maximum BIG5 code point is 0xFEFE. Thus it is possible to mix ASCII and BIG5 encodings in the same char string. More...
 
bool IsNull () const
 Determine if this BIG5 code point is 0. More...
 
bool IsPrivateUse () const
 BIG5 code points in the ranges 0xC6A1-0xC8FE, 0xC6A1-0xC8FE, and 0xF9D6-0xFEFE are for private use (user defined characters). More...
 
bool IsStandard (bool bNullIsValid, bool bASCIICodePointIsValid) const
 BIG5 code points in the ranges0xA140-0xA3Bf, 0xA440-0xC67E, and 0xC940-0xF9D5 are standard code points. More...
 
bool IsValid (bool bNullIsValid, bool bASCIICodePointIsValid) const
 Determine if the pair of code points is valid. If the values for BIG5 and Unicode code point values are &lt 0xFF and equal, the pair is considered valid. Use IsASCII() if you need to treat nonzero ASCII code points differently. More...
 
ON_Big5CodePointoperator= (const ON_Big5CodePoint &)=default
 

Static Public Member Functions

static int Compare (const ON_Big5CodePoint *lhs, const ON_Big5CodePoint *rhs)
 
static const ON_Big5CodePoint Create (unsigned int big5_code_point)
 Creates a BIG5 code point with the specified code point value. More...
 
static const ON_Big5CodePoint CreateFromUnicode (const class ON_UnicodeShortCodePoint &unicode_code_point, ON_Big5CodePoint not_available)
 Find a BIG5 code point with the same character as unicode_code_point. More...
 
static const ON_Big5CodePoint CreateFromUnicode (unsigned int unicode_code_point, ON_Big5CodePoint not_available)
 Find a BIG5 code point with the same character as unicode_code_point. More...
 
static const char * Decode (const char *buffer, size_t buffer_count, bool bParseNull, bool bParseASCII, ON_Big5CodePoint *big5_code_point)
 

Static Public Attributes

static const ON_Big5CodePoint Error
 ON_Big5CodePoint::Error has a code point value = 0xFFFF. (0xFFFF is not a valid BIG5 code point value.) More...
 
static const ON_Big5CodePoint Null
 ON_Big5CodePoint::NUll has a code point value = 0. More...
 
static const ON_Big5CodePoint WindowsEuro
 ON_Big5CodePoint::Error has a code point value = 0xA3E1. 0xA3E1 is in the BIG5 reserved section but old versions of Windows mapped it to the Euro currency symbol. The main use of this code is to translate from legacy BIG5 to Unicode, so this anomaly is supported. More...
 

Detailed Description

ON_Big5CodePoint is a tool to use when working with BIG5 encoded strings.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : unsigned int
Enumerator
MinimumCodePoint 
MinimumPrivateUseCodePoint 
MinimumStandardCodePoint 
MaximumStandardCodePoint 
MaximumPrivateUseCodePoint 
MaximumCodePoint 

Constructor & Destructor Documentation

◆ ON_Big5CodePoint() [1/2]

ON_Big5CodePoint::ON_Big5CodePoint ( )
default

◆ ~ON_Big5CodePoint()

ON_Big5CodePoint::~ON_Big5CodePoint ( )
default

◆ ON_Big5CodePoint() [2/2]

ON_Big5CodePoint::ON_Big5CodePoint ( const ON_Big5CodePoint )
default

Member Function Documentation

◆ Big5CodePoint()

unsigned int ON_Big5CodePoint::Big5CodePoint ( ) const

◆ Compare()

static int ON_Big5CodePoint::Compare ( const ON_Big5CodePoint lhs,
const ON_Big5CodePoint rhs 
)
static

◆ Create()

static const ON_Big5CodePoint ON_Big5CodePoint::Create ( unsigned int  big5_code_point)
static

Creates a BIG5 code point with the specified code point value.

Parameters
big5_code_pointA valid BIG5 code point, ASCII code point (0x00-0x7E), or the old Windows Euro currency symbol code point 0xA3E1 in the reserved area.
Returns
If big5_code_point is valid BIG5 code point or an ASCII code point, then a ON_Big5CodePoint instance with that value as code point is returned. Otherwise ON_Big5CodePoint::Error is returned.

◆ CreateFromUnicode() [1/2]

static const ON_Big5CodePoint ON_Big5CodePoint::CreateFromUnicode ( const class ON_UnicodeShortCodePoint unicode_code_point,
ON_Big5CodePoint  not_available 
)
static

Find a BIG5 code point with the same character as unicode_code_point.

Parameters
unicode_code_point
not_availableValue to return when unicode_code_point is valid but does not mapt to a BIG5 code point.
Returns
If there is a corresponding BIG5 or ASCII code point, that code point is returned. Otherwise, if unicode_code_point is valid, not_available is returned. Otherwise ON_Big5CodePoint::Error is returned.

◆ CreateFromUnicode() [2/2]

static const ON_Big5CodePoint ON_Big5CodePoint::CreateFromUnicode ( unsigned int  unicode_code_point,
ON_Big5CodePoint  not_available 
)
static

Find a BIG5 code point with the same character as unicode_code_point.

Parameters
unicode_code_point
not_availableValue to return when unicode_code_point is valid but does not mapt to a BIG5 code point.
Returns
If there is a corresponding BIG5 or ASCII code point, that code point is returned. Otherwise, if unicode_code_point is valid, not_available is returned. Otherwise ON_Big5CodePoint::Error is returned.

◆ Decode()

static const char* ON_Big5CodePoint::Decode ( const char *  buffer,
size_t  buffer_count,
bool  bParseNull,
bool  bParseASCII,
ON_Big5CodePoint big5_code_point 
)
static

◆ Encode()

int ON_Big5CodePoint::Encode ( char *  buffer,
size_t  buffer_capacity 
) const

◆ IsASCII()

bool ON_Big5CodePoint::IsASCII ( bool  bNullIsASCII) const

Strictly speaking, BIG5 does not extend ASCII, but it is common to mix single bytes ASCII and double byte BIG5 encodings in the same char string. BIG5 is a double byte string encoding with the first byte in the range 0x81 to 0xFE, the minimum BIG5 code point is 0x8140 and the maximum BIG5 code point is 0xFEFE. Thus it is possible to mix ASCII and BIG5 encodings in the same char string.

Parameters
bNullIsASCIIValue to return if this BIG5 code point equal to ON_Big5CodePoint::Null.
Returns
True if the code point value &le= 0x7F.

◆ IsNull()

bool ON_Big5CodePoint::IsNull ( ) const

Determine if this BIG5 code point is 0.

Returns
True if the code point value is 0.

◆ IsPrivateUse()

bool ON_Big5CodePoint::IsPrivateUse ( ) const

BIG5 code points in the ranges 0xC6A1-0xC8FE, 0xC6A1-0xC8FE, and 0xF9D6-0xFEFE are for private use (user defined characters).

Returns
True if this BIG5 code point is a private use (user defined) code point.

◆ IsStandard()

bool ON_Big5CodePoint::IsStandard ( bool  bNullIsValid,
bool  bASCIICodePointIsValid 
) const

BIG5 code points in the ranges0xA140-0xA3Bf, 0xA440-0xC67E, and 0xC940-0xF9D5 are standard code points.

Parameters
bNullIsValidValue to return if the code point value is 0.
bASCIICodePointIsValidValue to return if the code point value is an ASCII code point (&lt= 0x7F).
Returns
Returns true this BIG5 code point is a standard code point.

◆ IsValid()

bool ON_Big5CodePoint::IsValid ( bool  bNullIsValid,
bool  bASCIICodePointIsValid 
) const

Determine if the pair of code points is valid. If the values for BIG5 and Unicode code point values are &lt 0xFF and equal, the pair is considered valid. Use IsASCII() if you need to treat nonzero ASCII code points differently.

Parameters
bNullIsValidValue to return if the code point value is 0.
bASCIICodePointIsValidValue to return if the code point value is an ASCII code point (&lt= 0x7F).
Returns
True if the code point value is a valud BIG5 code point.

◆ operator=()

ON_Big5CodePoint& ON_Big5CodePoint::operator= ( const ON_Big5CodePoint )
default

Member Data Documentation

◆ Error

const ON_Big5CodePoint ON_Big5CodePoint::Error
static

ON_Big5CodePoint::Error has a code point value = 0xFFFF. (0xFFFF is not a valid BIG5 code point value.)

◆ Null

const ON_Big5CodePoint ON_Big5CodePoint::Null
static

ON_Big5CodePoint::NUll has a code point value = 0.

◆ WindowsEuro

const ON_Big5CodePoint ON_Big5CodePoint::WindowsEuro
static

ON_Big5CodePoint::Error has a code point value = 0xA3E1. 0xA3E1 is in the BIG5 reserved section but old versions of Windows mapped it to the Euro currency symbol. The main use of this code is to translate from legacy BIG5 to Unicode, so this anomaly is supported.