#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 105 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().
00106 {
00107 for (size_t i = 0; i < num_registry_entries_; i++)
00108 if (codeset_id == registry_db_[i].codeset_id_)
00109 return registry_db_[i].max_bytes_;
00110 return 0;
00111 }
|
|
||||||||||||
|
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 81 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().
00083 {
00084 registry_entry const * lhs = 0;
00085 registry_entry const * rhs = 0;
00086 for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++)
00087 {
00088 if (codeset_id == registry_db_[i].codeset_id_)
00089 lhs = ®istry_db_[i];
00090 if (other == registry_db_[i].codeset_id_)
00091 rhs = ®istry_db_[i];
00092 }
00093
00094 if (lhs == 0 || rhs == 0)
00095 return 0;
00096
00097 for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++)
00098 for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++)
00099 if (rhs->char_sets_[r] == lhs->char_sets_[l])
00100 return 1;
00101 return 0;
00102 }
|
|
||||||||||||||||||||
|
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,
00049 element->char_sets_,
00050 element->num_sets_ * sizeof (ACE_CDR::UShort));
00051 }
00052 return 1;
00053 }
|
|
||||||||||||||||||||
|
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 56 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().
00060 {
00061 registry_entry const * element = 0;
00062 for (size_t i = 0; element == 0 && i < num_registry_entries_; i++)
00063 if (codeset_id == registry_db_[i].codeset_id_)
00064 element = ®istry_db_[i];
00065 if (element == 0)
00066 return 0;
00067 locale.set(element->loc_name_);
00068 if (num_sets != 0)
00069 *num_sets = element->num_sets_;
00070 if (char_sets != 0)
00071 {
00072 ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0);
00073 ACE_OS::memcpy (*char_sets,
00074 element->char_sets_,
00075 element->num_sets_ * sizeof (ACE_CDR::UShort));
00076 }
00077 return 1;
00078 }
|
|
|
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(). |
1.3.6