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_character_data 00033 #define header_dom_character_data 00034 00035 #if _MSC_VER > 1000 00036 #pragma once 00037 #endif 00038 00039 #include "dom_node.h" 00040 00041 //: DOM Character Data class. 00042 //- !group=Core/XML! 00043 //- !header=core.h! 00044 //- <p>The CharacterData interface extends Node with a set of attributes and methods 00045 //- for accessing character data in the DOM. For clarity this set is defined here 00046 //- rather than on each object that uses these attributes and methods. No DOM objects 00047 //- correspond directly to CharacterData, though Text and others do inherit the 00048 //- interface from it.</p> 00049 class CL_DomCharacterData : public CL_DomNode 00050 { 00052 public: 00053 //: Constructs a DOM CharacterData handle. 00054 CL_DomCharacterData(); 00055 00056 CL_DomCharacterData(const CL_SharedPtr<CL_DomNode_Generic> &impl); 00057 00058 ~CL_DomCharacterData(); 00059 00061 public: 00062 //: The number of characters that are available through data and the substringData method below. 00063 //- <p>This may have the value zero, i.e., CharacterData nodes may be empty.</p> 00064 unsigned long get_length(); 00065 00067 public: 00068 //: Extracts a range of data from the node. 00069 //param offset: Start offset of substring to extract. 00070 //param count: The number of characters to extract. 00071 //retval: The specified substring. If the sum of offset and count exceeds the length, then all characters to the end of the data are returned. 00072 std::string substring_data(unsigned long offset, unsigned long count); 00073 00074 //: Append the string to the end of the character data of the node. 00075 void append_data(const std::string &arg); 00076 00077 //: Insert a string at the specified character offset. 00078 //param offset: The character offset at which to insert. 00079 //param arg: The DOMString to insert. 00080 void insert_data(unsigned long offset, const std::string &arg); 00081 00082 //: Remove a range of characters from the node. 00083 //param offset: The offset from which to remove characters. 00084 //param count: The number of characters to delete. If the sum of offset and count exceeds length then all characters from offset to the end of the data are deleted. 00085 void delete_data(unsigned long offset, unsigned long count); 00086 00087 //: Replace the characters starting at the specified character offset with the specified string. 00088 //param offset: The offset from which to start replacing. 00089 //param count: The number of characters to replace. If the sum of offset and count exceeds length, then all characters to the end of the data are replaced (i.e., the effect is the same as a remove method call with the same range, followed by an append method invocation). 00090 //param arg: The DOMString with which the range must be replaced. 00091 void replace_data(unsigned long offset, unsigned long count, const std::string &arg); 00092 00094 protected: 00095 CL_DomCharacterData(CL_DomDocument &doc, unsigned short node_type); 00096 }; 00097 00098 #endif
1.4.1