[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Codeset_Registry.inl
blob4419cf5e7fcebe0506ca985867865620739e5458
1 // -*- C++ -*-
2 //=============================================================================
3 /**
4  *  @file   Codeset_Registry.inl
5  *
6  *  $Id: Codeset_Registry.inl 80826 2008-03-04 14:51:23Z wotte $
7  *
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
11  *
12  *
13  *  @author Phil Mesnier <mesnier_p@ociweb.com>
14  */
15 //=============================================================================
17 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
19 ACE_INLINE
20 int
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(),
29                      &codeset_id,
30                      num_sets,
31                      char_sets,
32                      &result);
33   return (result == dce_cs_c_ok) ? 1 : 0;
34 #else
35   return ACE_Codeset_Registry::locale_to_registry_i (locale,
36                                                      codeset_id,
37                                                      num_sets,
38                                                      char_sets);
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.
44 ACE_INLINE
45 int
46 ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id,
47                                          ACE_CString &locale,
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;
53   char *buffer;
54   dce_cs_rgy_to_loc (codeset_id,
55                      &buffer,
56                      num_sets,
57                      char_sets,
58                      &result);
59   locale.set(buffer); // does a copy :-(
60   free (buffer);
61   return (result == dce_cs_c_ok) ? 1 : 0;
62 #else
63   return ACE_Codeset_Registry::registry_to_locale_i (codeset_id,
64                                                      locale,
65                                                      num_sets,
66                                                      char_sets);
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.
72 ACE_INLINE
73 int
74 ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id,
75                                      ACE_CDR::ULong other)
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;
81 #else
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.
88 ACE_INLINE
89 ACE_CDR::Short
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;
94   short max_bytes;
95   rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result);
96   return (result == rpc_s_ok) ? (short)max_bytes : 0;
97 #else
98   return ACE_Codeset_Registry::get_max_bytes_i (codeset_id);
99 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
102 ACE_END_VERSIONED_NAMESPACE_DECL