KHTML
dom_string.h
Go to the documentation of this file.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 <khtml_export.h>
00026 #include <kdebug.h>
00027 #include <QtCore/QString>
00028
00029 namespace DOM {
00030
00031 class DOMStringImpl;
00032
00042 class KHTML_EXPORT DOMString
00043 {
00044 friend class CharacterDataImpl;
00045 friend KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
00046 public:
00050 DOMString() : impl(0) {}
00051
00052 DOMString(const QChar *str, uint len);
00053 DOMString(const QString &);
00054 DOMString(const char *str);
00055 DOMString(DOMStringImpl *i);
00056
00057 virtual ~DOMString();
00058
00059
00060 DOMString(const DOMString &str);
00061 DOMString &operator =(const DOMString &str);
00062
00066 DOMString &operator += (const DOMString &str);
00070 DOMString operator + (const DOMString &str);
00071
00072 void insert(DOMString str, uint pos);
00073
00078 const QChar &operator [](unsigned int i) const;
00079
00080 int find(const QChar c, int start = 0) const;
00081
00082 uint length() const;
00083 void truncate( unsigned int len );
00084 void remove(unsigned int pos, int len=1);
00088 DOMString split(unsigned int pos);
00089
00093 DOMString lower() const;
00097 DOMString upper() const;
00098
00099 QChar *unicode() const;
00100 QString string() const;
00101
00102 int toInt() const;
00103 bool percentage(int &_percentage) const;
00104
00105 DOMString copy() const;
00106
00107 bool isNull() const { return (impl == 0); }
00108 bool isEmpty() const;
00109
00114 DOMStringImpl *implementation() const { return impl; }
00115
00116 protected:
00117 DOMStringImpl *impl;
00118 };
00119
00120 inline QDebug operator<<(QDebug stream, const DOMString &string) {
00121 return (stream << string.string());
00122 }
00123
00124 KHTML_EXPORT bool operator==( const DOMString &a, const DOMString &b );
00125 KHTML_EXPORT bool operator==( const DOMString &a, const QString &b );
00126 KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
00127 inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
00128 inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
00129 inline bool operator!=( const DOMString &a, const char *b ) { return !(a==b); }
00130 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
00131
00132
00133 KHTML_EXPORT bool strcasecmp( const DOMString &a, const DOMString &b );
00134 KHTML_EXPORT bool strcasecmp( const DOMString& a, const char* b );
00135
00136 }
00137 #endif