Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/express/unicodeLatinMap.h

Go to the documentation of this file.
00001 // Filename: unicodeLatinMap.h
00002 // Created by:  drose (01Feb03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef UNICODELATINMAP_H
00020 #define UNICODELATINMAP_H
00021 
00022 #include "pandabase.h"
00023 #include "pmap.h"
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : UnicodeLatinMap
00027 // Description : This class mainly serves as a container for a largish
00028 //               table of the subset of the Unicode character set that
00029 //               corresponds to the Latin alphabet, with its various
00030 //               accent marks and so on.  Specifically, this table
00031 //               indicates how to map between the Unicode accented
00032 //               character and the corresponding ASCII equivalent
00033 //               without the accent mark; as well as how to switch
00034 //               case from upper to lower while retaining the Unicode
00035 //               accent marks.
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDAEXPRESS UnicodeLatinMap {
00038 public:
00039   enum AccentType {
00040     AT_none,
00041     AT_acute,
00042     AT_acute_and_dot_above,
00043     AT_breve,
00044     AT_breve_and_acute,
00045     AT_breve_and_dot_below,
00046     AT_breve_and_grave,
00047     AT_breve_and_hook_above,
00048     AT_breve_and_tilde,
00049     AT_breve_below,
00050     AT_caron,
00051     AT_caron_and_dot_above,
00052     AT_cedilla,
00053     AT_cedilla_and_acute,
00054     AT_cedilla_and_breve,
00055     AT_circumflex,
00056     AT_circumflex_and_acute,
00057     AT_circumflex_and_dot_below,
00058     AT_circumflex_and_grave,
00059     AT_circumflex_and_hook_above,
00060     AT_circumflex_and_tilde,
00061     AT_circumflex_below,
00062     AT_comma_below,
00063     AT_curl,
00064     AT_diaeresis,
00065     AT_diaeresis_and_acute,
00066     AT_diaeresis_and_caron,
00067     AT_diaeresis_and_grave,
00068     AT_diaeresis_and_macron,
00069     AT_diaeresis_below,
00070     AT_dot_above,
00071     AT_dot_above_and_macron,
00072     AT_dot_below,
00073     AT_dot_below_and_dot_above,
00074     AT_dot_below_and_macron,
00075     AT_double_acute,
00076     AT_double_grave,
00077     AT_grave,
00078     AT_hook,
00079     AT_hook_above,
00080     AT_horn,
00081     AT_horn_and_acute,
00082     AT_horn_and_dot_below,
00083     AT_horn_and_grave,
00084     AT_horn_and_hook_above,
00085     AT_horn_and_tilde,
00086     AT_inverted_breve,
00087     AT_line_below,
00088     AT_macron,
00089     AT_macron_and_acute,
00090     AT_macron_and_diaeresis,
00091     AT_macron_and_grave,
00092     AT_ogonek,
00093     AT_ogonek_and_macron,
00094     AT_ring_above,
00095     AT_ring_above_and_acute,
00096     AT_ring_below,
00097     AT_stroke,
00098     AT_stroke_and_acute,
00099     AT_stroke_and_hook,
00100     AT_tilde,
00101     AT_tilde_and_acute,
00102     AT_tilde_and_diaeresis,
00103     AT_tilde_and_macron,
00104     AT_tilde_below,
00105     AT_topbar,
00106   };
00107 
00108   enum AdditionalFlags {
00109     AF_ligature   = 0x0001,
00110     AF_turned     = 0x0002,
00111     AF_reversed   = 0x0004,
00112     AF_smallcap   = 0x0008,
00113     AF_dotless    = 0x0010,
00114   };
00115   
00116   enum CharType {
00117     CT_upper,
00118     CT_lower,
00119     CT_punct,
00120   };
00121 
00122   class Entry {
00123   public:
00124     wchar_t _character;
00125     CharType _char_type;
00126     char _ascii_equiv;
00127     char _ascii_additional;
00128     wchar_t _tolower_character;
00129     wchar_t _toupper_character;
00130     AccentType _accent_type;
00131     int _additional_flags;
00132   };
00133 
00134   static const Entry *look_up(wchar_t character);
00135 
00136 private:
00137   static void init();
00138   static bool _initialized;
00139 
00140   typedef pmap<wchar_t, const Entry *> ByCharacter;
00141   static ByCharacter _by_character;
00142   enum { max_direct_chars = 256 };
00143   static const Entry *_direct_chars[max_direct_chars];
00144 };
00145 
00146 #endif

Generated on Fri May 2 00:38:46 2003 for Panda by doxygen1.3