00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef ACE_CODESET_REGISTRY_H
00025 #define ACE_CODESET_REGISTRY_H
00026 
00027 #include  "ace/pre.h"
00028 #include "ace/SString.h"
00029 #include "ace/CDR_Base.h"
00030 #include "ace/Codeset_Symbols.h"
00031 
00032 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00033 # pragma once
00034 #endif 
00035 
00036 #if defined (ACE_HAS_DCE_CODESET_REGISTRY)
00037 #include  <dce/rpc.h>
00038 #endif 
00039 
00040 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00041 
00042 class ACE_Export ACE_Codeset_Registry
00043 {
00044 public:
00045 
00046 
00047 
00048   static int locale_to_registry (const ACE_CString &locale,
00049                                  ACE_CDR::ULong &codeset_id,
00050                                  ACE_CDR::UShort * = 0,
00051                                  ACE_CDR::UShort ** = 0);
00052 
00053 
00054 
00055   static int registry_to_locale (ACE_CDR::ULong codeset_id,
00056                                  ACE_CString &locale,
00057                                  ACE_CDR::UShort * = 0,
00058                                  ACE_CDR::UShort ** = 0);
00059 
00060 
00061 
00062   static int is_compatible (ACE_CDR::ULong codeset_id,
00063                             ACE_CDR::ULong other);
00064 
00065 
00066 
00067   static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id);
00068 
00069   enum {max_charsets_ = 5};
00070 protected:
00071   typedef struct {
00072     const char *     desc_;
00073     const char *     loc_name_;
00074     ACE_CDR::ULong   codeset_id_;
00075     ACE_CDR::UShort  num_sets_;
00076     ACE_CDR::UShort  char_sets_[max_charsets_];
00077     ACE_CDR::UShort  max_bytes_;
00078   } registry_entry;
00079 
00080 private:
00081   static size_t const num_registry_entries_;
00082   static registry_entry const registry_db_[];
00083 
00084   static int locale_to_registry_i (const ACE_CString &locale,
00085                                    ACE_CDR::ULong &codeset_id,
00086                                    ACE_CDR::UShort * = 0,
00087                                    ACE_CDR::UShort ** = 0);
00088   static int registry_to_locale_i (ACE_CDR::ULong codeset_id,
00089                                    ACE_CString &locale,
00090                                    ACE_CDR::UShort * = 0,
00091                                    ACE_CDR::UShort ** = 0);
00092   static int is_compatible_i (ACE_CDR::ULong codeset_id,
00093                               ACE_CDR::ULong other);
00094   static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id);
00095 };
00096 
00097 ACE_END_VERSIONED_NAMESPACE_DECL
00098 
00099 #if defined (__ACE_INLINE__)
00100 #include "ace/Codeset_Registry.inl"
00101 #endif 
00102 
00103 #include  "ace/post.h"
00104 #endif