Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / Codeset_Registry.h
blobe72c435f82b14391b2538c7b397d25fb51a0de2b
1 // -*- C++ -*-
2 //=============================================================================
3 /**
4 * @file Codeset_Registry.h
6 * $Id: Codeset_Registry.h 81348 2008-04-14 09:00:32Z johnnyw $
8 * ACE wrapper around access functions for the OSF's DCE codeset registry
9 * access functions
11 * For environments that intrinsicly support the DCE defined access functions,
12 * the methods in this class are simply wrappers. On other platforms, emulation
13 * is provided. The motivation for this class is to support interoperability
14 * via translators and the CDR streams, primarily in TAO, but this capability
15 * is not restricted to CORBA.
17 * The emulated functionality supports Open Group RFC #40, currently RFC 40.2,
18 * www.opengroup.org/tech/rfc/rfc40.2.html
20 * @author Phil Mesnier <mesnier_p@ociweb.com>
22 //=============================================================================
24 #ifndef ACE_CODESET_REGISTRY_H
25 #define ACE_CODESET_REGISTRY_H
27 #include /**/ "ace/pre.h"
28 #include "ace/SString.h"
29 #include "ace/CDR_Base.h"
30 #include "ace/Codeset_Symbols.h"
32 #if !defined (ACE_LACKS_PRAGMA_ONCE)
33 # pragma once
34 #endif /* ACE_LACKS_PRAGMA_ONCE */
36 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
37 #include /**/ <dce/rpc.h>
38 #endif /* ACE_HAS_DCE_CODESET_REGISTRY */
40 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
42 class ACE_Export ACE_Codeset_Registry
44 public:
46 /// Based on a locale string, find the registry value and optional codeset
47 /// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it.
48 static int locale_to_registry (const ACE_CString &locale,
49 ACE_CDR::ULong &codeset_id,
50 ACE_CDR::UShort * = 0,
51 ACE_CDR::UShort ** = 0);
53 /// Based on a registry value, find the locale string and optional codeset
54 /// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it.
55 static int registry_to_locale (ACE_CDR::ULong codeset_id,
56 ACE_CString &locale,
57 ACE_CDR::UShort * = 0,
58 ACE_CDR::UShort ** = 0);
60 /// Tell if two codesets are compatible. This wraps the
61 /// rpc_cs_char_set_compat_check function.
62 static int is_compatible (ACE_CDR::ULong codeset_id,
63 ACE_CDR::ULong other);
65 /// Return the max number of bytes required to represent a single character.
66 /// This wraps the rpc_rgy_get_max_bytes function.
67 static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id);
69 enum {max_charsets_ = 5};
70 protected:
71 typedef struct {
72 const char * desc_;
73 const char * loc_name_;
74 ACE_CDR::ULong codeset_id_;
75 ACE_CDR::UShort num_sets_;
76 ACE_CDR::UShort char_sets_[max_charsets_];
77 ACE_CDR::UShort max_bytes_;
78 } registry_entry;
80 private:
81 static size_t const num_registry_entries_;
82 static registry_entry const registry_db_[];
84 static int locale_to_registry_i (const ACE_CString &locale,
85 ACE_CDR::ULong &codeset_id,
86 ACE_CDR::UShort * = 0,
87 ACE_CDR::UShort ** = 0);
88 static int registry_to_locale_i (ACE_CDR::ULong codeset_id,
89 ACE_CString &locale,
90 ACE_CDR::UShort * = 0,
91 ACE_CDR::UShort ** = 0);
92 static int is_compatible_i (ACE_CDR::ULong codeset_id,
93 ACE_CDR::ULong other);
94 static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id);
97 ACE_END_VERSIONED_NAMESPACE_DECL
99 #if defined (__ACE_INLINE__)
100 #include "ace/Codeset_Registry.inl"
101 #endif /* __ACE_INLINE__ */
103 #include /**/ "ace/post.h"
104 #endif /* ACE_CODESET_REGISTRY_H */