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_load 00033 #define header_xml_token_load 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_XMLTokenLoad_Generic; 00044 class CL_XMLTokenString; 00045 00046 //: XML token in a XML file. 00047 //- !group=Core/XML! 00048 //- !header=core.h! 00049 class CL_XMLTokenLoad : public CL_XMLToken 00050 { 00052 public: 00053 CL_XMLTokenLoad(); 00054 CL_XMLTokenLoad(const CL_XMLTokenLoad ©); 00055 00056 virtual ~CL_XMLTokenLoad(); 00057 00059 public: 00060 00061 //: Returns the token type. 00062 virtual TokenType get_type() const; 00063 00064 //: Returns the token variant. 00065 virtual TokenVariant get_variant() const; 00066 00067 //: Returns the name of the token. 00068 virtual std::string get_name() const; 00069 00070 //: Returns the value of the token. 00071 virtual std::string get_value() const; 00072 00073 //: Returns number of attributes. 00074 virtual int get_attributes_number() const; 00075 00076 //: Returns the attribute name and value for attribute with specified index. 00077 virtual std::pair<std::string, std::string> get_attribute(int attribute_num) const; 00078 00079 const std::pair<CL_XMLTokenString, CL_XMLTokenString> & get_attribute_fast(int attribute_num) const; 00080 00082 public: 00083 //: Sets the type of the token. 00084 void set_type(TokenType type); 00085 00086 //: Sets if token ends with a slash. 00087 void set_variant(TokenVariant variant); 00088 00089 //: Sets the name of the token. 00090 void set_name(const CL_XMLTokenString & name); 00091 00092 //: Sets the value of the token. 00093 void set_value(const CL_XMLTokenString & value); 00094 00095 //: Attaches attribute to token. 00096 void set_attribute(const CL_XMLTokenString & name, const CL_XMLTokenString & value); 00097 00099 private: 00100 CL_SharedPtr<CL_XMLTokenLoad_Generic> impl; 00101 }; 00102 00103 #endif
1.4.1