faithtools/faith/char.h

Go to the documentation of this file.
00001 #ifndef KDE__CHAR_H
00002 #define KDE__CHAR_H
00003 
00004 #include <faith/string.h>
00005 #include <faith/tools.h>
00006 
00007 
00008 namespace Faith
00009 {
00010 
00011 class CharRef;
00012 class String;
00013 
00017 class FAITH_TOOLS_EXPORT Char
00018 {
00019         uint32_t ch;
00020 public:
00024         Char(unsigned short s);
00028         Char(const Char &copy);
00029         Char(const CharRef &copy);
00030 
00031         bool operator ==(const Char &other) const;
00032         bool operator !=(const Char &other) const
00033         {
00034                 return !operator==(other);
00035         }
00036 
00037         Char &operator =(const Char &copy);
00038         Char &operator =(unsigned short c);
00039         Char &operator =(const CharRef &c);
00040 
00041         char latin1() const { return ch; }
00042         unsigned short unicode() const { return ch; }
00043         uint32_t unicode32() const { return ch; }
00044 
00048         bool isNull() const;
00053         bool isPrint() const;
00061         bool isSpace() const;
00066         bool isLetterOrNumber() const;
00070         bool isDigit() const;
00071 
00076         bool isLetter() const;
00077 };
00078 
00082 class FAITH_TOOLS_EXPORT CharRef
00083 {
00084         friend class ::Faith::String;
00085         String &mString;
00086         int mOffset;
00087 
00088         CharRef(String &str, int offset);
00089 public:
00090         CharRef(const CharRef &copy);
00091         bool operator ==(const Char &other) const;
00092         bool operator ==(const CharRef &other) const;
00093         bool operator !=(const Char &other) const { return !operator==(other); }
00094         bool operator !=(const CharRef &other) const { return !operator==(other); }
00095 
00096         CharRef &operator =(const Char &copy);
00097         CharRef &operator =(unsigned short c);
00098         CharRef &operator =(const CharRef &c);
00099 
00100         char latin1() const { return unicode32(); }
00101         unsigned short unicode() const { return unicode32(); }
00102         uint32_t unicode32() const;
00103 
00104         bool isNull() const { return Char(*this).isNull(); }
00105         bool isPrint() const { return Char(*this).isPrint(); }
00106         bool isSpace() const { return Char(*this).isSpace(); }
00107         bool isLetterOrNumber() const { return Char(*this).isLetterOrNumber(); }
00108         bool isDigit() const { return Char(*this).isDigit(); }
00109         bool isLetter() const { return Char(*this).isLetter(); }
00110 };
00111 
00112 }
00113 #endif

Generated on Fri Sep 1 00:23:07 2006 for Faith by  doxygen 1.4.7