khtml Library API Documentation

dom_textimpl.h

00001 /*
00002  * This file is part of the DOM implementation for KDE.
00003  *
00004  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
00005  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  *
00022  * $Id: dom_textimpl.h,v 1.53.4.1 2003/01/03 21:09:29 mueller Exp $
00023  */
00024 #ifndef _DOM_CharacterDataImpl_h_
00025 #define _DOM_CharacterDataImpl_h_
00026 
00027 #include "xml/dom_nodeimpl.h"
00028 #include "dom/dom_string.h"
00029 
00030 namespace DOM {
00031 
00032     class DocumentImpl;
00033 
00034 class CharacterDataImpl : public NodeImpl
00035 {
00036 public:
00037     CharacterDataImpl(DocumentPtr *doc, DOMStringImpl* _text);
00038     CharacterDataImpl(DocumentPtr *doc)
00039         : NodeImpl(doc), str(0) {}
00040 
00041     virtual ~CharacterDataImpl();
00042 
00043     // DOM methods & attributes for CharacterData
00044 
00045     virtual void setData( const DOMString &_data, int &exceptioncode );
00046     virtual unsigned long length (  ) const;
00047     virtual DOMString substringData ( const unsigned long offset, const unsigned long count, int &exceptioncode );
00048     virtual void appendData ( const DOMString &arg, int &exceptioncode );
00049     virtual void insertData ( const unsigned long offset, const DOMString &arg, int &exceptioncode );
00050     virtual void deleteData ( const unsigned long offset, const unsigned long count, int &exceptioncode );
00051     virtual void replaceData ( const unsigned long offset, const unsigned long count, const DOMString &arg, int &exceptioncode );
00052 
00053     // DOM methods overridden from  parent classes
00054 
00055     virtual DOMString nodeValue() const;
00056     virtual void setNodeValue( const DOMString &_nodeValue, int &exceptioncode );
00057 
00058     // Other methods (not part of DOM)
00059 
00060     DOMStringImpl *string() const { return str; }
00061     DOMString data() const { return str; }
00062 
00063     virtual void checkCharDataOperation( const unsigned long offset, int &exceptioncode );
00064 #ifndef NDEBUG
00065     virtual void dump(QTextStream *stream, QString ind = "") const;
00066 #endif
00067 
00068 protected:
00069     // note: since DOMStrings are shared, str should always be copied when making
00070     // a change or returning a string
00071     DOMStringImpl *str;
00072 
00073     void dispatchModifiedEvent(DOMStringImpl *prevValue);
00074 };
00075 
00076 // ----------------------------------------------------------------------------
00077 
00078 class CommentImpl : public CharacterDataImpl
00079 {
00080 public:
00081     CommentImpl(DocumentPtr *doc, DOMStringImpl* _text)
00082         : CharacterDataImpl(doc, _text) {}
00083     CommentImpl(DocumentPtr *doc)
00084         : CharacterDataImpl(doc) {}
00085     // DOM methods overridden from  parent classes
00086     virtual DOMString nodeName() const;
00087     virtual unsigned short nodeType() const;
00088     virtual NodeImpl *cloneNode(bool deep);
00089 
00090     // Other methods (not part of DOM)
00091 
00092     virtual Id id() const;
00093     virtual bool childTypeAllowed( unsigned short type );
00094 };
00095 
00096 // ----------------------------------------------------------------------------
00097 
00098 class TextImpl : public CharacterDataImpl
00099 {
00100 public:
00101     TextImpl(DocumentPtr *impl, DOMStringImpl* _text)
00102         : CharacterDataImpl(impl, _text) {}
00103     TextImpl(DocumentPtr *impl)
00104         : CharacterDataImpl(impl) {}
00105 
00106     // DOM methods & attributes for CharacterData
00107 
00108     TextImpl *splitText ( const unsigned long offset, int &exceptioncode );
00109 
00110     // DOM methods overridden from  parent classes
00111     virtual DOMString nodeName() const;
00112     virtual unsigned short nodeType() const;
00113     virtual NodeImpl *cloneNode(bool deep);
00114 
00115     // Other methods (not part of DOM)
00116 
00117     virtual bool isTextNode() const { return true; }
00118     virtual Id id() const;
00119     virtual void attach();
00120     virtual void recalcStyle( StyleChange = NoChange );
00121     virtual bool childTypeAllowed( unsigned short type );
00122 
00123 protected:
00124     virtual TextImpl *createNew(DOMStringImpl *_str);
00125 };
00126 
00127 // ----------------------------------------------------------------------------
00128 
00129 class CDATASectionImpl : public TextImpl
00130 {
00131 public:
00132     CDATASectionImpl(DocumentPtr *impl, DOMStringImpl* _text)
00133         : TextImpl(impl, _text) {}
00134     CDATASectionImpl(DocumentPtr *impl)
00135         : TextImpl(impl) {}
00136 
00137     // DOM methods overridden from  parent classes
00138     virtual DOMString nodeName() const;
00139     virtual unsigned short nodeType() const;
00140     virtual NodeImpl *cloneNode(bool deep);
00141 
00142     // Other methods (not part of DOM)
00143 
00144     virtual bool childTypeAllowed( unsigned short type );
00145 
00146 protected:
00147     virtual TextImpl *createNew(DOMStringImpl *_str);
00148 };
00149 
00150 
00151 
00152 }; //namespace
00153 #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