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_xml_token_save 00033 #define header_xml_token_save 00034 00035 #if _MSC_VER > 1000 00036 #pragma once 00037 #endif 00038 00039 #include "sharedptr.h" 00040 #include "xml_token.h" 00041 #include <string> 00042 00043 class CL_XMLTokenSave_Generic; 00044 class CL_XMLTokenString; 00045 00046 //: XML token in a XML file. 00047 //- !group=Core/XML! 00048 //- !header=core.h! 00049 class CL_XMLTokenSave : public CL_XMLToken 00050 { 00052 public: 00053 CL_XMLTokenSave(); 00054 00055 CL_XMLTokenSave(const CL_XMLTokenSave ©); 00056 00057 virtual ~CL_XMLTokenSave(); 00058 00060 public: 00061 00062 //: Returns the token type. 00063 virtual TokenType get_type() const; 00064 00065 //: Returns the token variant. 00066 virtual TokenVariant get_variant() const; 00067 00068 //: Returns the name of the token. 00069 virtual std::string get_name() const; 00070 00071 //: Returns the value of the token. 00072 virtual std::string get_value() const; 00073 00074 //: Returns number of attributes. 00075 virtual int get_attributes_number() const; 00076 00077 //: Returns the attribute name and value for attribute with specified index. 00078 virtual std::pair<std::string, std::string> get_attribute(int attribute_num) const; 00079 00081 public: 00082 //: Sets the type of the token. 00083 void set_type(TokenType type); 00084 00085 //: Sets if token ends with a slash. 00086 void set_variant(TokenVariant variant); 00087 00088 //: Sets the name of the token. 00089 void set_name(const std::string & name); 00090 00091 //: Sets the value of the token. 00092 void set_value(const std::string & value); 00093 00094 //: Attaches attribute to token. 00095 void set_attribute(const std::string & name, const std::string & value); 00096 00098 private: 00099 CL_SharedPtr<CL_XMLTokenSave_Generic> impl; 00100 }; 00101 00102 #endif
1.4.1