Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ychar.h

Go to the documentation of this file.
00001 /************************************************************************
00002  * $Id: ychar.h,v 1.2 2007-04-13 16:15:57 mbickel Exp $
00003  *
00004  * ------------
00005  * Description:
00006  * ------------
00007  * ychar.h
00008  *
00009  * A unicode lightweight character class
00010  *
00011  * (C) Copyright 2004 Arabeyes, Mohammed Yousif
00012  *
00013  * -----------------
00014  * Revision Details:    (Updated by Revision Control System)
00015  * -----------------
00016  *  $Date: 2007-04-13 16:15:57 $
00017  *  $Author: mbickel $
00018  *  $Revision: 1.2 $
00019  *  $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/ychar.h,v $
00020  *
00021  *  (www.arabeyes.org - under GPL License)
00022  *
00023  ************************************************************************/
00024 
00025 #ifndef YCHAR_H
00026 #define YCHAR_H
00027 
00028 #ifdef _MSC_VER
00029 #pragma warning(disable : 4290)
00030 #endif
00031 
00032 #include <stdexcept>
00033 #include <string>
00034 
00035 typedef unsigned int uint32;
00036 typedef unsigned char byte;
00037 
00038 class DECLSPEC YChar {
00039 public:
00040         YChar();
00041         YChar(const uint32);
00042         YChar(const int);
00043         YChar(const char);
00044         YChar(const char *) throw(std::domain_error);
00045         YChar(const std::string) throw(std::domain_error);
00046 
00047         YChar lower() const;
00048         YChar upper() const;
00049         YChar title() const;
00050         int digitValue() const throw(std::domain_error);
00051         int hexDigitValue() const throw(std::domain_error);
00052 
00053         bool isNull() const;
00054         bool isAsciiLetter() const;
00055 
00056         int bytes() const;
00057         std::string utf8() const;
00058 
00059         static int getNumberOfContinuingOctents(byte)  throw(std::domain_error);
00060         static YChar fromUtf8(const char *) throw(std::domain_error);
00061         static YChar fromUtf8(const std::string) throw(std::domain_error);
00062 
00063         //operator char();
00064         operator uint32() const;
00065 
00066         friend bool operator==(const YChar &, const YChar &);
00067         friend bool operator==(const YChar &, const char &);
00068         friend bool operator==(const char &, const YChar &);
00069         friend bool operator==(const YChar &, const int &);
00070         friend bool operator==(const int &, const YChar &);
00071         friend std::ostream & operator<<( std::ostream &, YChar);
00072 
00073 private:
00074         uint32 ucs4;
00075 };
00076 
00077 bool operator==(const YChar &, const YChar &);
00078 bool operator==(const YChar &, const char &);
00079 bool operator==(const char &, const YChar &);
00080 bool operator==(const YChar &, const int &);
00081 bool operator==(const int &, const YChar &);
00082 
00083 std::ostream & operator<<( std::ostream &, YChar);
00084 std::istream & operator>>( std::istream &, YChar &);
00085 
00086 #endif /* YCHAR_H */

Generated on Tue Jun 24 01:27:56 2008 for Advanced Strategic Command by  doxygen 1.4.2