2 //=============================================================================
4 * @file Codeset_Registry.inl
6 * $Id: Codeset_Registry.inl 80826 2008-03-04 14:51:23Z wotte $
8 * ACE wrapper around access functions for the OSF's DCE codeset registry
9 * access functions - the inline functions either call the system supplied
10 * DCE based codeset regsitry function, or calls the emulation
13 * @author Phil Mesnier <mesnier_p@ociweb.com>
15 //=============================================================================
17 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
21 ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale,
22 ACE_CDR::ULong &codeset_id,
23 ACE_CDR::UShort *num_sets,
24 ACE_CDR::UShort **char_sets)
26 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
27 error_status_t result;
28 dce_cs_loc_to_rgy (locale.c_str(),
33 return (result == dce_cs_c_ok) ? 1 : 0;
35 return ACE_Codeset_Registry::locale_to_registry_i (locale,
39 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
42 // based on a registry value, find the locale string and optional codeset
43 // collection. This wraps the dce_cs_rgy_to_loc function, or emulates it.
46 ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id,
48 ACE_CDR::UShort *num_sets,
49 ACE_CDR::UShort **char_sets)
51 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
52 error_status_t result;
54 dce_cs_rgy_to_loc (codeset_id,
59 locale.set(buffer); // does a copy :-(
61 return (result == dce_cs_c_ok) ? 1 : 0;
63 return ACE_Codeset_Registry::registry_to_locale_i (codeset_id,
67 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
70 // Tell if two codesets are compatible. This wraps the
71 // rpc_cs_char_set_compat_check function.
74 ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id,
77 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
78 error_status_t result;
79 rpc_cs_char_set_compat_check(codeset_id,other,&result);
80 return (result == rpc_s_ok) ? 1 : 0;
82 return ACE_Codeset_Registry::is_compatible_i (codeset_id,other);
83 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
86 // Return the max number of bytes required to represent a single character.
87 // This wraps the rpc_rgy_get_max_bytes function.
90 ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id)
92 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
93 error_status_t result;
95 rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result);
96 return (result == rpc_s_ok) ? (short)max_bytes : 0;
98 return ACE_Codeset_Registry::get_max_bytes_i (codeset_id);
99 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
102 ACE_END_VERSIONED_NAMESPACE_DECL