GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Codeset_Registry.h
blob8fc9944c8296b7414e4b45263a229468f5beb7b5
1 // -*- C++ -*-
2 //=============================================================================
3 /**
4 * @file Codeset_Registry.h
6 * ACE wrapper around access functions for the OSF's DCE codeset registry
7 * access functions
9 * For environments that intrinsicly 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)
31 # pragma once
32 #endif /* ACE_LACKS_PRAGMA_ONCE */
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
36 class ACE_Export ACE_Codeset_Registry
38 public:
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,
49 ACE_CString &locale,
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};
63 protected:
64 typedef struct {
65 const char * desc_;
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_;
71 } registry_entry;
73 private:
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,
82 ACE_CString &locale,
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 */