dom_string.h
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef _DOM_DOMString_h_
00023 #define _DOM_DOMString_h_
00024 
00025 #include <kdebug.h>
00026 #include <qstring.h>
00027 
00028 namespace DOM {
00029 
00030 class DOMStringImpl;
00031 
00041 class DOMString
00042 {
00043     friend class CharacterDataImpl;
00044     friend bool operator==( const DOMString &a, const char *b );
00045 public:
00049     DOMString() : impl(0) {}
00050 
00051     DOMString(const QChar *str, uint len);
00052     DOMString(const QString &);
00053     DOMString(const char *str);
00054     DOMString(DOMStringImpl *i);
00055 
00056     virtual ~DOMString();
00057 
00058     
00059     DOMString(const DOMString &str);
00060     DOMString &operator =(const DOMString &str);
00061 
00065     DOMString &operator += (const DOMString &str);
00069     DOMString operator + (const DOMString &str);
00070 
00071     void insert(DOMString str, uint pos);
00072 
00077     const QChar &operator [](unsigned int i) const;
00078 
00079     int find(const QChar c, int start = 0) const;
00080 
00081     uint length() const;
00082     void truncate( unsigned int len );
00083     void remove(unsigned int pos, int len=1);
00087     DOMString split(unsigned int pos);
00088 
00092     DOMString lower() const;
00096     DOMString upper() const;
00097 
00098     QChar *unicode() const;
00099     QString string() const;
00100 
00101     int toInt() const;
00102     bool percentage(int &_percentage) const;
00103 
00104     DOMString copy() const;
00105 
00106     bool isNull()  const { return (impl == 0); }
00107     bool isEmpty()  const;
00108 
00113     DOMStringImpl *implementation() const { return impl; }
00114 
00115 protected:
00116     DOMStringImpl *impl;
00117 };
00118 
00119 #ifndef NDEBUG
00120 inline kdbgstream &operator<<(kdbgstream &stream, const DOMString &string) { 
00121     return (stream << string.string());
00122 }
00123 #else
00124 inline kndbgstream &operator<<(kndbgstream &stream, const DOMString &string) {
00125     return stream;
00126 }
00127 #endif
00128 
00129 bool operator==( const DOMString &a, const DOMString &b );
00130 bool operator==( const DOMString &a, const QString &b );
00131 bool operator==( const DOMString &a, const char *b );
00132 inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
00133 inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
00134 inline bool operator!=( const DOMString &a, const char *b )  { return !(a==b); }
00135 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
00136 
00137 
00138 bool strcasecmp( const DOMString &a, const DOMString &b );
00139 bool strcasecmp( const DOMString& a, const char* b );
00140 
00141 }
00142 #endif
 
This file is part of the documentation for khtml Library Version 3.2.0.