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  * $Id: dom_string.h,v 1.27 2002/03/05 23:13:27 rich Exp $
00022  */
00023 #ifndef _DOM_DOMString_h_
00024 #define _DOM_DOMString_h_
00025 
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();
00050 
00051     DOMString(const QChar *str, uint len);
00052     DOMString(const QString &);
00053     DOMString(const char *str);
00054     DOMString(DOMStringImpl *i);
00055     virtual ~DOMString();
00056 
00057     // assign and copy
00058     DOMString(const DOMString &str);
00059     DOMString &operator =(const DOMString &str);
00060 
00064     DOMString &operator += (const DOMString &str);
00068     DOMString operator + (const DOMString &str);
00069 
00070     void insert(DOMString str, uint pos);
00071 
00076     const QChar &operator [](unsigned int i) const;
00077 
00078     int find(const QChar c, int start = 0) const;
00079 
00080     uint length() const;
00081     void truncate( unsigned int len );
00082     void remove(unsigned int pos, int len=1);
00086     DOMString split(unsigned int pos);
00087 
00091     DOMString lower() const;
00095     DOMString upper() const;
00096 
00097     QChar *unicode() const;
00098     QString string() const;
00099 
00100     int toInt() const;
00101     bool percentage(int &_percentage) const;
00102 
00103     DOMString copy() const;
00104 
00105     bool isNull()  const { return (impl == 0); }
00106     bool isEmpty()  const;
00107 
00112     DOMStringImpl *implementation() const { return impl; }
00113 
00114 protected:
00115     DOMStringImpl *impl;
00116 };
00117 
00118 bool operator==( const DOMString &a, const DOMString &b );
00119 bool operator==( const DOMString &a, const QString &b );
00120 bool operator==( const DOMString &a, const char *b );
00121 inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); };
00122 inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); };
00123 inline bool operator!=( const DOMString &a, const char *b )  { return !(a==b); };
00124 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
00125 
00126 // returns false when equal, true otherwise (ignoring case)
00127 bool strcasecmp( const DOMString &a, const DOMString &b );
00128 bool strcasecmp( const DOMString& a, const char* b );
00129 
00130 };
00131 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:36 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001