00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2005 The ClanLib Team 00004 ** 00005 ** This software is provided 'as-is', without any express or implied 00006 ** warranty. In no event will the authors be held liable for any damages 00007 ** arising from the use of this software. 00008 ** 00009 ** Permission is granted to anyone to use this software for any purpose, 00010 ** including commercial applications, and to alter it and redistribute it 00011 ** freely, subject to the following restrictions: 00012 ** 00013 ** 1. The origin of this software must not be misrepresented; you must not 00014 ** claim that you wrote the original software. If you use this software 00015 ** in a product, an acknowledgment in the product documentation would be 00016 ** appreciated but is not required. 00017 ** 2. Altered source versions must be plainly marked as such, and must not be 00018 ** misrepresented as being the original software. 00019 ** 3. This notice may not be removed or altered from any source distribution. 00020 ** 00021 ** Note: Some of the libraries ClanLib link to may have additional 00022 ** requirements or restrictions. 00023 ** 00024 ** File Author(s): 00025 ** 00026 ** Magnus Norddahl 00027 */ 00028 00031 00032 #ifndef header_dom_text 00033 #define header_dom_text 00034 00035 #if _MSC_VER > 1000 00036 #pragma once 00037 #endif 00038 00039 #include "dom_character_data.h" 00040 00041 //: DOM Text class. 00042 //- !group=Core/XML! 00043 //- !header=core.h! 00044 //- <p>The Text interface represents the textual content (termed character data 00045 //- in XML) of an Element or Attr. If there is no markup inside an element's content, 00046 //- the text is contained in a single object implementing the Text interface that is 00047 //- the only child of the element. If there is markup, it is parsed into a list of 00048 //- elements and Text nodes that form the list of children of the element.</p> 00049 //- <p>When a document is first made available via the DOM, there is only one Text 00050 //- node for each block of text. Users may create adjacent Text nodes that represent 00051 //- the contents of a given element without any intervening markup, but should be aware 00052 //- that there is no way to represent the separations between these nodes in XML or HTML, 00053 //- so they will not (in general) persist between DOM editing sessions. The normalize() 00054 //- method on Element merges any such adjacent Text objects into a single node for each 00055 //- block of text; this is recommended before employing operations that depend on a 00056 //- particular document structure, such as navigation with XPointers.</p> 00057 class CL_DomText : public CL_DomCharacterData 00058 { 00060 public: 00061 //: Constructs a DOM Text handle. 00062 CL_DomText(); 00063 00064 CL_DomText(CL_DomDocument &doc, const std::string &data); 00065 00066 CL_DomText(const CL_SharedPtr<CL_DomNode_Generic> &impl); 00067 00068 ~CL_DomText(); 00069 00071 public: 00072 00074 public: 00075 //: Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblings. 00076 //- <p>node then only contains all the content up to the offset point. And a new Text node, which 00077 //- is inserted as the next sibling of this node, contains all the content at and after the offset 00078 //- point.</p> 00079 //param offset: The offset at which to split. 00080 //retval: The new Text node. 00081 CL_DomText split_text(unsigned long offset); 00082 00084 protected: 00085 CL_DomText(CL_DomDocument &doc, unsigned short node_type); 00086 }; 00087 00088 #endif
1.4.1