khtml Library API Documentation

dom_string.h

00001 /* 00002 * This file is part of the DOM implementation for KDE. 00003 * 00004 * (C) 1999 Lars Knoll (knoll@kde.org) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 * Boston, MA 02111-1307, USA. 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 // assign and copy 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 &) { 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 // returns false when equal, true otherwise (ignoring case) 00138 bool strcasecmp( const DOMString &a, const DOMString &b ); 00139 bool strcasecmp( const DOMString& a, const char* b ); 00140 00141 } 00142 #endif
KDE Logo
This file is part of the documentation for khtml Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:44:53 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003