#include <Codeset_Registry.h>
Definition at line 42 of file Codeset_Registry.h.
anonymous enum |
ACE_CDR::Short ACE_Codeset_Registry::get_max_bytes | ( | ACE_CDR::ULong | codeset_id | ) | [inline, static] |
Return the max number of bytes required to represent a single character. This wraps the rpc_rgy_get_max_bytes function.
Definition at line 90 of file Codeset_Registry.inl.
{ #if defined (ACE_HAS_DCE_CODESET_REGISTRY) error_status_t result; short max_bytes; rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result); return (result == rpc_s_ok) ? (short)max_bytes : 0; #else return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ }
ACE_CDR::Short ACE_Codeset_Registry::get_max_bytes_i | ( | ACE_CDR::ULong | codeset_id | ) | [static, private] |
Definition at line 103 of file Codeset_Registry.cpp.
{ for (size_t i = 0; i < num_registry_entries_; i++) if (codeset_id == registry_db_[i].codeset_id_) return registry_db_[i].max_bytes_; return 0; }
int ACE_Codeset_Registry::is_compatible | ( | ACE_CDR::ULong | codeset_id, | |
ACE_CDR::ULong | other | |||
) | [inline, static] |
Tell if two codesets are compatible. This wraps the rpc_cs_char_set_compat_check function.
Definition at line 74 of file Codeset_Registry.inl.
{ #if defined (ACE_HAS_DCE_CODESET_REGISTRY) error_status_t result; rpc_cs_char_set_compat_check(codeset_id,other,&result); return (result == rpc_s_ok) ? 1 : 0; #else return ACE_Codeset_Registry::is_compatible_i (codeset_id,other); #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ }
int ACE_Codeset_Registry::is_compatible_i | ( | ACE_CDR::ULong | codeset_id, | |
ACE_CDR::ULong | other | |||
) | [static, private] |
Definition at line 79 of file Codeset_Registry.cpp.
{ registry_entry const *lhs = 0; registry_entry const *rhs = 0; for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++) { if (codeset_id == registry_db_[i].codeset_id_) lhs = ®istry_db_[i]; if (other == registry_db_[i].codeset_id_) rhs = ®istry_db_[i]; } if (lhs == 0 || rhs == 0) return 0; for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++) for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++) if (rhs->char_sets_[r] == lhs->char_sets_[l]) return 1; return 0; }
int ACE_Codeset_Registry::locale_to_registry | ( | const ACE_CString & | locale, | |
ACE_CDR::ULong & | codeset_id, | |||
ACE_CDR::UShort * | num_sets = 0 , |
|||
ACE_CDR::UShort ** | char_sets = 0 | |||
) | [inline, static] |
Based on a locale string, find the registry value and optional codeset collection. This wraps the dce_cs_loc_to_rgy function, or emulates it.
Definition at line 21 of file Codeset_Registry.inl.
{ #if defined (ACE_HAS_DCE_CODESET_REGISTRY) error_status_t result; dce_cs_loc_to_rgy (locale.c_str(), &codeset_id, num_sets, char_sets, &result); return (result == dce_cs_c_ok) ? 1 : 0; #else return ACE_Codeset_Registry::locale_to_registry_i (locale, codeset_id, num_sets, char_sets); #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ }
static int ACE_Codeset_Registry::locale_to_registry_i | ( | const ACE_CString & | locale, | |
ACE_CDR::ULong & | codeset_id, | |||
ACE_CDR::UShort * | = 0 , |
|||
ACE_CDR::UShort ** | = 0 | |||
) | [static, private] |
int ACE_Codeset_Registry::registry_to_locale | ( | ACE_CDR::ULong | codeset_id, | |
ACE_CString & | locale, | |||
ACE_CDR::UShort * | num_sets = 0 , |
|||
ACE_CDR::UShort ** | char_sets = 0 | |||
) | [inline, static] |
Based on a registry value, find the locale string and optional codeset collection. This wraps the dce_cs_rgy_to_loc function, or emulates it.
Definition at line 46 of file Codeset_Registry.inl.
{ #if defined (ACE_HAS_DCE_CODESET_REGISTRY) error_status_t result; char *buffer; dce_cs_rgy_to_loc (codeset_id, &buffer, num_sets, char_sets, &result); locale.set(buffer); // does a copy :-( free (buffer); return (result == dce_cs_c_ok) ? 1 : 0; #else return ACE_Codeset_Registry::registry_to_locale_i (codeset_id, locale, num_sets, char_sets); #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ }
int ACE_Codeset_Registry::registry_to_locale_i | ( | ACE_CDR::ULong | codeset_id, | |
ACE_CString & | locale, | |||
ACE_CDR::UShort * | num_sets = 0 , |
|||
ACE_CDR::UShort ** | char_sets = 0 | |||
) | [static, private] |
Definition at line 55 of file Codeset_Registry.cpp.
{ registry_entry const *element = 0; for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) if (codeset_id == registry_db_[i].codeset_id_) element = ®istry_db_[i]; if (element == 0) return 0; locale.set (element->loc_name_); if (num_sets != 0) *num_sets = element->num_sets_; if (char_sets != 0) { ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); ACE_OS::memcpy (*char_sets, element->char_sets_, element->num_sets_ * sizeof (ACE_CDR::UShort)); } return 1; }
size_t const ACE_Codeset_Registry::num_registry_entries_ = 9 [static, private] |
Definition at line 81 of file Codeset_Registry.h.
ACE_Codeset_Registry::registry_entry const ACE_Codeset_Registry::registry_db_ [static, private] |
{ {"ISO/IEC 10646-1:1993; UCS-2, Level 1","UCS-2",0x00010100,1,{0x1000},2}, {"ISO 8859-1:1987; Latin Alphabet No. 1","ISO8859_1",0x00010001,1,{0x0011},1}, {"IBM-1047 (CCSID 01047); Latin-1 Open System","EBCDIC",0x10020417,1,{0x0011},1}, {"ISO/IEC 10646-1:1993; UCS-4, Level 1","UCS-4",0x00010104,1,{0x1000},4}, {"ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form","UTF-16",0x00010109,1,{0x1000},2}, {"X/Open UTF-8; UCS Transformation Format 8 (UTF-8)","UTF-8",0x05010001,1,{0x1000},6}, {"ISO/IEC 8859-5:1988; Latin-Cyrillic Alphabet","ISO-8859-5",0x00010005,1,{0x0015},1}, {"IBM-1251 (CCSID 01251); MS Windows Cyrillic","CP1251",0x100204e3,1,{0x0015},1}, {"IBM-855 (CCSID 04951); Cyrillic Personal Computer","CP855",0x10021357,1,{0x0015},1} }
Definition at line 82 of file Codeset_Registry.h.