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

Codeset_Registry.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //=============================================================================
00003 /**
00004  *  @file   Codeset_Registry.inl
00005  *
00006  *  $Id: Codeset_Registry.inl,v 1.1.8.1 2003/04/10 14:12:27 phil Exp $
00007  *
00008  * ACE wrapper around access functions for the OSF's DCE codeset registry
00009  * access functions - the inline functions either call the system supplied
00010  * DCE based codeset regsitry function, or calls the emulation
00011  *
00012  *
00013  *  @author Phil Mesnier <mesnier_p@ociweb.com>
00014  */
00015 //=============================================================================
00016 
00017 ACE_INLINE
00018 int
00019 ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale,
00020                                          ACE_CDR::ULong &codeset_id,
00021                                          ACE_CDR::UShort *num_sets,
00022                                          ACE_CDR::UShort **char_sets)
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 }
00039 
00040 // based on a registry value, find the locale string and optional codeset
00041 // collection.  This wraps the dce_cs_rgy_to_loc function, or emulates it.
00042 ACE_INLINE
00043 int
00044 ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id,
00045                                          ACE_CString &locale,
00046                                          ACE_CDR::UShort *num_sets,
00047                                          ACE_CDR::UShort **char_sets)
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 }
00067 
00068 // tell if two codesets are compatible. This wraps the
00069 //rpc_cs_char_set_compat_check function.
00070 ACE_INLINE
00071 int
00072 ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id,
00073                                      ACE_CDR::ULong other)
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 }
00083 
00084 // return the max number of bytes required to represent a single character.
00085 // This wraps the rpc_rgy_get_max_bytes function.
00086 ACE_INLINE
00087 ACE_CDR::Short
00088 ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id)
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 }

Generated on Mon Jun 16 11:19:22 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002