| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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 #include <kdelibs_export.h>
    00029
    00030 namespace DOM {
    00031
    00032 class DOMStringImpl;
    00033
    00043 class KHTML_EXPORT DOMString
    00044 {
    00045     friend class CharacterDataImpl;
    00046     friend bool operator==( const DOMString &a, const char *b );
    00047 public:
    00051     DOMString() : impl(0) {}
    00052
    00053     DOMString(const QChar *str, uint len);
    00054     DOMString(const QString &);
    00055     DOMString(const char *str);
    00056     DOMString(DOMStringImpl *i);
    00057
    00058     virtual ~DOMString();
    00059
    00060     // assign and copy
    00061     DOMString(const DOMString &str);
    00062     DOMString &operator =(const DOMString &str);
    00063
    00067     DOMString &operator += (const DOMString &str);
    00071     DOMString operator + (const DOMString &str);
    00072
    00073     void insert(DOMString str, uint pos);
    00074
    00079     const QChar &operator [](unsigned int i) const;
    00080
    00081     int find(const QChar c, int start = 0) const;
    00082
    00083     uint length() const;
    00084     void truncate( unsigned int len );
    00085     void remove(unsigned int pos, int len=1);
    00089     DOMString split(unsigned int pos);
    00090
    00094     DOMString lower() const;
    00098     DOMString upper() const;
    00099
    00100     QChar *unicode() const;
    00101     QString string() const;
    00102
    00103     int toInt() const;
    00104     bool percentage(int &_percentage) const;
    00105
    00106     DOMString copy() const;
    00107
    00108     bool isNull()  const { return (impl == 0); }
    00109     bool isEmpty()  const;
    00110
    00115     DOMStringImpl *implementation() const { return impl; }
    00116
    00117 protected:
    00118     DOMStringImpl *impl;
    00119 };
    00120
    00121 #ifndef NDEBUG
    00122 inline kdbgstream &operator<<(kdbgstream &stream, const DOMString &string) {
    00123     return (stream << string.string());
    00124 }
    00125 #else
    00126 inline kndbgstream &operator<<(kndbgstream &stream, const DOMString &) {
    00127     return stream;
    00128 }
    00129 #endif
    00130
    00131 KHTML_EXPORT bool operator==( const DOMString &a, const DOMString &b );
    00132 KHTML_EXPORT bool operator==( const DOMString &a, const QString &b );
    00133 KHTML_EXPORT bool operator==( const DOMString &a, const char *b );
    00134 inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
    00135 inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
    00136 inline bool operator!=( const DOMString &a, const char *b )  { return !(a==b); }
    00137 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
    00138
    00139 // returns false when equal, true otherwise (ignoring case)
    00140 KHTML_EXPORT bool strcasecmp( const DOMString &a, const DOMString &b );
    00141 KHTML_EXPORT bool strcasecmp( const DOMString& a, const char* b );
    00142
    00143 }
    00144 #endif

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:10 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003