2 //=============================================================================
4 * @file Codeset_Registry.h
6 * ACE wrapper around access functions for the OSF's DCE codeset registry
9 * For environments that intrinsically support the DCE defined access functions,
10 * the methods in this class are simply wrappers. On other platforms, emulation
11 * is provided. The motivation for this class is to support interoperability
12 * via translators and the CDR streams, primarily in TAO, but this capability
13 * is not restricted to CORBA.
15 * The emulated functionality supports Open Group RFC #40, currently RFC 40.2,
16 * www.opengroup.org/tech/rfc/rfc40.2.html
18 * @author Phil Mesnier <mesnier_p@ociweb.com>
20 //=============================================================================
22 #ifndef ACE_CODESET_REGISTRY_H
23 #define ACE_CODESET_REGISTRY_H
25 #include /**/ "ace/pre.h"
26 #include "ace/SString.h"
27 #include "ace/CDR_Base.h"
28 #include "ace/Codeset_Symbols.h"
30 #if !defined (ACE_LACKS_PRAGMA_ONCE)
32 #endif /* ACE_LACKS_PRAGMA_ONCE */
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
36 class ACE_Export ACE_Codeset_Registry
39 /// Based on a locale string, find the registry value and optional codeset
40 /// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it.
41 static int locale_to_registry (const ACE_CString
&locale
,
42 ACE_CDR::ULong
&codeset_id
,
43 ACE_CDR::UShort
* = 0,
44 ACE_CDR::UShort
** = 0);
46 /// Based on a registry value, find the locale string and optional codeset
47 /// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it.
48 static int registry_to_locale (ACE_CDR::ULong codeset_id
,
50 ACE_CDR::UShort
* = 0,
51 ACE_CDR::UShort
** = 0);
53 /// Tell if two codesets are compatible. This wraps the
54 /// rpc_cs_char_set_compat_check function.
55 static int is_compatible (ACE_CDR::ULong codeset_id
,
56 ACE_CDR::ULong other
);
58 /// Return the max number of bytes required to represent a single character.
59 /// This wraps the rpc_rgy_get_max_bytes function.
60 static ACE_CDR::Short
get_max_bytes (ACE_CDR::ULong codeset_id
);
62 enum {max_charsets_
= 5};
66 const char * loc_name_
;
67 ACE_CDR::ULong codeset_id_
;
68 ACE_CDR::UShort num_sets_
;
69 ACE_CDR::UShort char_sets_
[max_charsets_
];
70 ACE_CDR::UShort max_bytes_
;
74 static size_t const num_registry_entries_
;
75 static registry_entry
const registry_db_
[];
77 static int locale_to_registry_i (const ACE_CString
&locale
,
78 ACE_CDR::ULong
&codeset_id
,
79 ACE_CDR::UShort
* = 0,
80 ACE_CDR::UShort
** = 0);
81 static int registry_to_locale_i (ACE_CDR::ULong codeset_id
,
83 ACE_CDR::UShort
* = 0,
84 ACE_CDR::UShort
** = 0);
85 static int is_compatible_i (ACE_CDR::ULong codeset_id
,
86 ACE_CDR::ULong other
);
87 static ACE_CDR::Short
get_max_bytes_i (ACE_CDR::ULong codeset_id
);
90 ACE_END_VERSIONED_NAMESPACE_DECL
92 #if defined (__ACE_INLINE__)
93 #include "ace/Codeset_Registry.inl"
94 #endif /* __ACE_INLINE__ */
96 #include /**/ "ace/post.h"
97 #endif /* ACE_CODESET_REGISTRY_H */