Main Page | Modules | Namespace List | Compound List | File List | Compound Members | File Members | Related Pages

UMString.h

Go to the documentation of this file.
00001 #ifndef UMString_H__
00002 #define UMString_H__
00003 
00004 #include <string>
00005 #include <wchar.h>
00006 #include <windows.h>
00007 using namespace std;
00008 
00009 #ifndef UINT
00010         typedef unsigned int UINT;
00011 #endif
00012 
00013 typedef enum CHARTYPE
00014 {
00015         HiraChar, KataChar, KanjiChar, LatinChar,
00016         LatinPunct, JapPunct,
00017         UnknownChar
00018 };
00019 
00020 // Global function declarations
00021 
00022 bool IsASCII(const wchar_t tmp_uc_char);
00023 bool IsWideChar(const wchar_t tmp_uc_char);
00024 bool IsHira(const wchar_t tmp_uc_char);
00025 bool IsKata(const wchar_t tmp_uc_char);
00026 bool IsKanji(const wchar_t tmp_uc_char);
00027 bool IsKana(const wchar_t tmp_uc_char);
00028 bool IsLatinChar(const wchar_t tmp_uc_char);
00029 bool IsLatinPunct(const wchar_t tmp_uc_char);
00030 bool IsJapPunct(const wchar_t tmp_uc_char);
00031 bool IsNumber(const wchar_t tmp_uc_char);
00032 const CHARTYPE IsWhat(const wchar_t tmp_uc_char);
00033 string GetEUCFromSJIS(const string& SJISString);
00034 string GetSJISFromEUC(const string& EUCString);
00035 
00059 class UMString
00060 {
00061         // Private data members
00062 
00063         wchar_t *uc_string;             
00064         char    *mb_string;             
00065         UINT    si;                             
00067 public:
00068 
00069         // Constructors/Destructor
00070 
00071         UMString();
00072         UMString(const UMString& tmp_umstring);
00073         UMString(const char* tmp_mb_string);
00074         UMString(const wstring tmp_uc_string);
00075         UMString(const wchar_t* tmp_uc_string);
00076         UMString(const string tmp_stlstring);
00077         ~UMString();
00078 
00079         /* -------------------------
00080           | Public member functions |
00081            ------------------------- */
00082 
00083         // Basic Operations
00084         
00085         UINT                    GetLengthUC() const;
00086         UINT                    GetLengthMB() const;
00087         wchar_t*                PushString(const wchar_t* tmp_uc_string);
00088         char*                   PushString(const char* tmp_mb_string);
00089         wchar_t*                GetStringUC() const;
00090         char*                   GetStringMB() const;
00091         void                    Clear();
00092 
00093         // Advanced Operations
00094 
00095         bool                    ReplaceSubstring(const UINT First, const UINT Last, const UMString NewString);
00096         //bool                  InsertString(const UINT Where, const UMString NewString);               // Still to do
00097 
00098         // Sliding Index Functions
00099 
00100         bool                    SI_Set(const UINT x);
00101         UINT                    SI_Get() const;
00102         UINT                    SI_Forward();
00103         UINT                    SI_Backward();
00104         bool                    SI_NextHira();
00105         bool                    SI_NextKata();
00106         bool                    SI_NextKanji();
00107         bool                    SI_NextDifferent();
00108         bool                    SI_PrevHira();
00109         bool                    SI_PrevKata();
00110         bool                    SI_PrevKanji();
00111         bool                    SI_PrevDifferent();
00112         bool                    SI_TokenStart();
00113         bool                    SI_TokenEnd();
00114         const UMString  SI_GetToken();
00115         const UMString  SI_GetTokenPosAfter();
00116         const UMString  SI_GetRemaining() const;
00117         const UMString  SI_GetSizedString(const UINT first, const UINT last) const;
00118         const wchar_t   SI_GetChar() const;
00119         const wchar_t   SI_GetCharNext() const;
00120         void                    SI_SetChar(const wchar_t tmp_uc_char);
00121         int                             SI_GetPosChar(wchar_t& ucchar, UINT offset=0);
00122         bool                    SI_SetPosChar(wchar_t& ucchar);
00123         bool                    SI_SplitUMString(UMString&, UMString&, const UINT); 
00124         // Operator overloads
00125         
00126         const UMString& operator=(const UMString& right);
00127         bool    operator==(const UMString& right);
00128         const UMString  operator+(const UMString& right);
00129 
00130         //wchar_t                       operator()(const UINT x);
00132         operator const  char*() const {return mb_string;}
00134         operator const  wchar_t*() const {return uc_string;}
00136         operator const  string() const {return mb_string;}
00138         operator                char*() {return mb_string;}
00140         operator                wchar_t*() {return uc_string;}
00142         operator                string() {return mb_string;}
00143 
00144 private:
00145 
00146         // Private internal helper functions
00147         
00148         void MB2UC();
00149         void UC2MB();
00150 };
00151 
00152 #endif // UMSTRING_H__

Generated on Mon Aug 18 19:27:09 2003 for LeJa by doxygen 1.3.3