Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Codeset_Registry Class Reference

#include <Codeset_Registry.h>

List of all members.

Public Types

enum  { max_charsets_ = 5 }

Static Public Methods

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 Methods

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 num_registry_entries_ = 4
registry_entry registry_db_ []


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
max_charsets_ 

Definition at line 66 of file Codeset_Registry.h.

00066 {max_charsets_ = 5};


Member Function Documentation

ACE_INLINE ACE_CDR::Short ACE_Codeset_Registry::get_max_bytes ACE_CDR::ULong    codeset_id [static]
 

Definition at line 88 of file Codeset_Registry.inl.

References get_max_bytes_i, and ACE_CDR::ULong.

00089 {
00090 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
00091   error_status_t result;
00092   short max_bytes;
00093   rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result);
00094   return (result == rpc_s_ok) ? (short)max_bytes : 0;
00095 #else
00096   return ACE_Codeset_Registry::get_max_bytes_i (codeset_id);
00097 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
00098 }

ACE_CDR::Short ACE_Codeset_Registry::get_max_bytes_i ACE_CDR::ULong    codeset_id [static, private]
 

Definition at line 101 of file Codeset_Registry.cpp.

References ACE_Codeset_Registry::registry_entry::codeset_id_, ACE_Codeset_Registry::registry_entry::max_bytes_, num_registry_entries_, registry_db_, and ACE_CDR::ULong.

Referenced by get_max_bytes.

00102 {
00103   for (size_t i = 0; i < num_registry_entries_; i++)
00104     if (codeset_id == registry_db_[i].codeset_id_)
00105       return registry_db_[i].max_bytes_;
00106   return 0;
00107 }

ACE_INLINE int ACE_Codeset_Registry::is_compatible ACE_CDR::ULong    codeset_id,
ACE_CDR::ULong    other
[static]
 

Definition at line 72 of file Codeset_Registry.inl.

References is_compatible_i, and ACE_CDR::ULong.

00074 {
00075 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
00076   error_status_t result;
00077   rpc_cs_char_set_compat_check(codeset_id,other,&result);
00078   return (result == rpc_s_ok) ? 1 : 0;
00079 #else
00080   return ACE_Codeset_Registry::is_compatible_i (codeset_id,other);
00081 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
00082 }

int ACE_Codeset_Registry::is_compatible_i ACE_CDR::ULong    codeset_id,
ACE_CDR::ULong    other
[static, private]
 

Definition at line 77 of file Codeset_Registry.cpp.

References ACE_Codeset_Registry::registry_entry::codeset_id_, num_registry_entries_, registry_db_, ACE_CDR::ULong, and ACE_CDR::UShort.

Referenced by is_compatible.

00079 {
00080   registry_entry* lhs = 0;
00081   registry_entry* rhs = 0;
00082   for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++)
00083     {
00084       if (codeset_id == registry_db_[i].codeset_id_)
00085         lhs = &registry_db_[i];
00086       if (other == registry_db_[i].codeset_id_)
00087         rhs = &registry_db_[i];
00088     }
00089 
00090   if (lhs == 0 || rhs == 0)
00091     return 0;
00092 
00093   for (ACE_CDR::UShort l = 0; l < lhs->num_sets_; l++)
00094     for (ACE_CDR::UShort r = 0; r < rhs->num_sets_; r++)
00095       if (rhs->char_sets_[r] == lhs->char_sets_[l])
00096         return 1;
00097   return 0;
00098 }

ACE_INLINE int ACE_Codeset_Registry::locale_to_registry const ACE_CString   locale,
ACE_CDR::ULong   codeset_id,
ACE_CDR::UShort   = 0,
ACE_CDR::UShort **    = 0
[static]
 

Definition at line 19 of file Codeset_Registry.inl.

References ACE_String_Base< char >::c_str, locale_to_registry_i, ACE_CDR::ULong, and ACE_CDR::UShort.

00023 {
00024 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
00025   error_status_t result;
00026   dce_cs_loc_to_rgy (locale.c_str(),
00027                      &codeset_id,
00028                      num_sets,
00029                      char_sets,
00030                      &result);
00031   return (result == dce_cs_c_ok) ? 1 : 0;
00032 #else
00033   return ACE_Codeset_Registry::locale_to_registry_i (locale,
00034                                                      codeset_id,
00035                                                      num_sets,
00036                                                      char_sets);
00037 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
00038 }

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]
 

Definition at line 27 of file Codeset_Registry.cpp.

References ACE_NEW_RETURN, ACE_String_Base< char >::c_str, ACE_Codeset_Registry::registry_entry::codeset_id_, ACE_OS_String::memcpy, num_registry_entries_, registry_db_, ACE_OS_String::strcmp, ACE_CDR::ULong, and ACE_CDR::UShort.

Referenced by locale_to_registry.

00031 {
00032   registry_entry* element = 0;
00033   for (size_t i = 0; element == 0 && i < num_registry_entries_; i++)
00034     if (ACE_OS::strcmp(registry_db_[i].loc_name_,locale.c_str()) == 0)
00035       element = &registry_db_[i];
00036   if (element == 0)
00037     return 0;
00038   codeset_id = element->codeset_id_;
00039   if (num_sets != 0)
00040     *num_sets = element->num_sets_;
00041   if (char_sets != 0)
00042     {
00043       ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0);
00044       ACE_OS::memcpy (element->char_sets_,
00045                       *char_sets,
00046                       element->num_sets_ * sizeof (ACE_CDR::UShort));
00047     }
00048   return 1;
00049 }

ACE_INLINE int ACE_Codeset_Registry::registry_to_locale ACE_CDR::ULong    codeset_id,
ACE_CString   locale,
ACE_CDR::UShort   = 0,
ACE_CDR::UShort **    = 0
[static]
 

Definition at line 44 of file Codeset_Registry.inl.

References registry_to_locale_i, ACE_String_Base< char >::set, ACE_CDR::ULong, and ACE_CDR::UShort.

00048 {
00049 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
00050   error_status_t result;
00051   char *buffer;
00052   dce_cs_rgy_to_loc (codeset_id,
00053                      &buffer,
00054                      num_sets,
00055                      char_sets,
00056                      &result);
00057   locale.set(buffer); // does a copy :-(
00058   free (buffer);
00059   return (result == dce_cs_c_ok) ? 1 : 0;
00060 #else
00061   return ACE_Codeset_Registry::registry_to_locale_i (codeset_id,
00062                                                      locale,
00063                                                      num_sets,
00064                                                      char_sets);
00065 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
00066 }

int ACE_Codeset_Registry::registry_to_locale_i ACE_CDR::ULong    codeset_id,
ACE_CString   locale,
ACE_CDR::UShort   = 0,
ACE_CDR::UShort **    = 0
[static, private]
 

Definition at line 52 of file Codeset_Registry.cpp.

References ACE_NEW_RETURN, ACE_Codeset_Registry::registry_entry::codeset_id_, ACE_OS_String::memcpy, num_registry_entries_, registry_db_, ACE_String_Base< char >::set, ACE_CDR::ULong, and ACE_CDR::UShort.

Referenced by registry_to_locale.

00056 {
00057   registry_entry* element = 0;
00058   for (size_t i = 0; element == 0 && i < num_registry_entries_; i++)
00059     if (codeset_id == registry_db_[i].codeset_id_)
00060       element = &registry_db_[i];
00061   if (element == 0)
00062     return 0;
00063   locale.set(element->loc_name_);
00064   if (num_sets != 0)
00065     *num_sets = element->num_sets_;
00066   if (char_sets != 0)
00067     {
00068       ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0);
00069       ACE_OS::memcpy (element->char_sets_,
00070                       *char_sets,
00071                       element->num_sets_ * sizeof (ACE_CDR::UShort));
00072     }
00073   return 1;
00074 }


Member Data Documentation

size_t ACE_Codeset_Registry::num_registry_entries_ = 4 [static, private]
 

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.

ACE_Codeset_Registry::registry_entry ACE_Codeset_Registry::registry_db_ [static, private]
 

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.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:46:37 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002