#include <Codeset_Registry.h>
Collaboration diagram for ACE_Codeset_Registry:
Public Types | |
enum | { max_charsets_ = 5 } |
Static Public Member Functions | |
int | locale_to_registry (const ACE_CString &locale, ACE_CDR::ULong &codeset_id, ACE_CDR::UShort *=0, ACE_CDR::UShort **=0) |
int | registry_to_locale (ACE_CDR::ULong codeset_id, ACE_CString &locale, ACE_CDR::UShort *=0, ACE_CDR::UShort **=0) |
int | is_compatible (ACE_CDR::ULong codeset_id, ACE_CDR::ULong other) |
ACE_CDR::Short | get_max_bytes (ACE_CDR::ULong codeset_id) |
Static Private Member Functions | |
int | locale_to_registry_i (const ACE_CString &locale, ACE_CDR::ULong &codeset_id, ACE_CDR::UShort *=0, ACE_CDR::UShort **=0) |
int | registry_to_locale_i (ACE_CDR::ULong codeset_id, ACE_CString &locale, ACE_CDR::UShort *=0, ACE_CDR::UShort **=0) |
int | is_compatible_i (ACE_CDR::ULong codeset_id, ACE_CDR::ULong other) |
ACE_CDR::Short | get_max_bytes_i (ACE_CDR::ULong codeset_id) |
Static Private Attributes | |
size_t const | num_registry_entries_ = 4 |
registry_entry const | registry_db_ [] |
|
Definition at line 69 of file Codeset_Registry.h.
00069 {max_charsets_ = 5}; |
|
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. References get_max_bytes_i(), and ACE_CDR::ULong.
00091 { 00092 #if defined (ACE_HAS_DCE_CODESET_REGISTRY) 00093 error_status_t result; 00094 short max_bytes; 00095 rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result); 00096 return (result == rpc_s_ok) ? (short)max_bytes : 0; 00097 #else 00098 return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); 00099 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ 00100 } |
|
Definition at line 103 of file Codeset_Registry.cpp. References ACE_Codeset_Registry::registry_entry::codeset_id_, num_registry_entries_, registry_db_, and ACE_CDR::ULong. Referenced by get_max_bytes().
00104 { 00105 for (size_t i = 0; i < num_registry_entries_; i++) 00106 if (codeset_id == registry_db_[i].codeset_id_) 00107 return registry_db_[i].max_bytes_; 00108 return 0; 00109 } |
|
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. References is_compatible_i(), and ACE_CDR::ULong.
00076 { 00077 #if defined (ACE_HAS_DCE_CODESET_REGISTRY) 00078 error_status_t result; 00079 rpc_cs_char_set_compat_check(codeset_id,other,&result); 00080 return (result == rpc_s_ok) ? 1 : 0; 00081 #else 00082 return ACE_Codeset_Registry::is_compatible_i (codeset_id,other); 00083 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ 00084 } |
|
Definition at line 79 of file Codeset_Registry.cpp. References ACE_Codeset_Registry::registry_entry::char_sets_, ACE_Codeset_Registry::registry_entry::codeset_id_, num_registry_entries_, ACE_Codeset_Registry::registry_entry::num_sets_, registry_db_, ACE_CDR::ULong, and ACE_CDR::UShort. Referenced by is_compatible().
00081 { 00082 registry_entry const *lhs = 0; 00083 registry_entry const *rhs = 0; 00084 for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++) 00085 { 00086 if (codeset_id == registry_db_[i].codeset_id_) 00087 lhs = ®istry_db_[i]; 00088 if (other == registry_db_[i].codeset_id_) 00089 rhs = ®istry_db_[i]; 00090 } 00091 00092 if (lhs == 0 || rhs == 0) 00093 return 0; 00094 00095 for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++) 00096 for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++) 00097 if (rhs->char_sets_[r] == lhs->char_sets_[l]) 00098 return 1; 00099 return 0; 00100 } |
|
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. References ACE_CString, ACE_String_Base< CHAR >::c_str(), locale_to_registry_i(), ACE_CDR::ULong, and ACE_CDR::UShort.
00025 { 00026 #if defined (ACE_HAS_DCE_CODESET_REGISTRY) 00027 error_status_t result; 00028 dce_cs_loc_to_rgy (locale.c_str(), 00029 &codeset_id, 00030 num_sets, 00031 char_sets, 00032 &result); 00033 return (result == dce_cs_c_ok) ? 1 : 0; 00034 #else 00035 return ACE_Codeset_Registry::locale_to_registry_i (locale, 00036 codeset_id, 00037 num_sets, 00038 char_sets); 00039 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ 00040 } |
|
Definition at line 31 of file Codeset_Registry.cpp. References ACE_CString, ACE_NEW_RETURN, ACE_String_Base< CHAR >::c_str(), ACE_Codeset_Registry::registry_entry::char_sets_, ACE_Codeset_Registry::registry_entry::codeset_id_, ACE_OS::memcpy(), num_registry_entries_, ACE_Codeset_Registry::registry_entry::num_sets_, registry_db_, ACE_OS::strcmp(), ACE_CDR::ULong, and ACE_CDR::UShort. Referenced by locale_to_registry().
00035 { 00036 registry_entry const *element = 0; 00037 for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) 00038 if (ACE_OS::strcmp (registry_db_[i].loc_name_, locale.c_str ()) == 0) 00039 element = ®istry_db_[i]; 00040 if (element == 0) 00041 return 0; 00042 codeset_id = element->codeset_id_; 00043 if (num_sets != 0) 00044 *num_sets = element->num_sets_; 00045 if (char_sets != 0) 00046 { 00047 ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); 00048 ACE_OS::memcpy (*char_sets, element->char_sets_, 00049 element->num_sets_ * sizeof (ACE_CDR::UShort)); 00050 } 00051 return 1; 00052 } |
|
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. References ACE_CString, registry_to_locale_i(), ACE_String_Base< CHAR >::set(), ACE_CDR::ULong, and ACE_CDR::UShort.
00050 { 00051 #if defined (ACE_HAS_DCE_CODESET_REGISTRY) 00052 error_status_t result; 00053 char *buffer; 00054 dce_cs_rgy_to_loc (codeset_id, 00055 &buffer, 00056 num_sets, 00057 char_sets, 00058 &result); 00059 locale.set(buffer); // does a copy :-( 00060 free (buffer); 00061 return (result == dce_cs_c_ok) ? 1 : 0; 00062 #else 00063 return ACE_Codeset_Registry::registry_to_locale_i (codeset_id, 00064 locale, 00065 num_sets, 00066 char_sets); 00067 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ 00068 } |
|
Definition at line 55 of file Codeset_Registry.cpp. References ACE_CString, ACE_NEW_RETURN, ACE_Codeset_Registry::registry_entry::char_sets_, ACE_Codeset_Registry::registry_entry::codeset_id_, ACE_Codeset_Registry::registry_entry::loc_name_, ACE_OS::memcpy(), num_registry_entries_, ACE_Codeset_Registry::registry_entry::num_sets_, registry_db_, ACE_String_Base< CHAR >::set(), ACE_CDR::ULong, and ACE_CDR::UShort. Referenced by registry_to_locale().
00059 { 00060 registry_entry const *element = 0; 00061 for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) 00062 if (codeset_id == registry_db_[i].codeset_id_) 00063 element = ®istry_db_[i]; 00064 if (element == 0) 00065 return 0; 00066 locale.set (element->loc_name_); 00067 if (num_sets != 0) 00068 *num_sets = element->num_sets_; 00069 if (char_sets != 0) 00070 { 00071 ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); 00072 ACE_OS::memcpy (*char_sets, element->char_sets_, 00073 element->num_sets_ * sizeof (ACE_CDR::UShort)); 00074 } 00075 return 1; 00076 } |
|
Definition at line 26 of file Codeset_Registry_db.cpp. Referenced by get_max_bytes_i(), is_compatible_i(), locale_to_registry_i(), and registry_to_locale_i(). |
|
Initial value: { {"ISO 8859-1:1987; Latin Alphabet No. 1","ASCII",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","Unicode",0x00010109,1,{0x1000},2} } Definition at line 18 of file Codeset_Registry_db.cpp. Referenced by get_max_bytes_i(), is_compatible_i(), locale_to_registry_i(), and registry_to_locale_i(). |