Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

xml_token_save.cpp

Go to the documentation of this file.
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 
00029 #include "precomp.h"
00030 #include "xml_token_save.h"
00031 #include "xml_token_save_generic.h"
00032 
00034 // CL_XMLTokenSave construction:
00035 
00036 CL_XMLTokenSave::CL_XMLTokenSave()
00037         : impl(new CL_XMLTokenSave_Generic)
00038 {
00039 }
00040         
00041 CL_XMLTokenSave::CL_XMLTokenSave(const CL_XMLTokenSave &copy)
00042         : impl(copy.impl)
00043 {
00044 }
00045         
00046 CL_XMLTokenSave::~CL_XMLTokenSave()
00047 {
00048 }
00049         
00051 // CL_XMLTokenSave attributes:
00052 
00053 CL_XMLTokenSave::TokenType CL_XMLTokenSave::get_type() const
00054 {
00055         return impl->type;
00056 }
00057 
00058 CL_XMLTokenSave::TokenVariant CL_XMLTokenSave::get_variant() const
00059 {
00060         return impl->variant;
00061 }
00062 
00063 std::string CL_XMLTokenSave::get_name() const
00064 {
00065         return impl->name;
00066 }
00067 
00068 std::string CL_XMLTokenSave::get_value() const
00069 {
00070         return impl->value;
00071 }
00072 
00073 int CL_XMLTokenSave::get_attributes_number() const
00074 {
00075         return impl->attributes.size();
00076 }
00077 
00078 std::pair<std::string, std::string> CL_XMLTokenSave::get_attribute(int attribute_num) const
00079 {
00080         if (attribute_num < 0 || attribute_num >= (int)impl->attributes.size())
00081                 return std::make_pair(std::string(), std::string());
00082 
00083         return impl->attributes[attribute_num];
00084 }
00085 
00087 // CL_XMLTokenSave operations:
00088 
00089 void CL_XMLTokenSave::set_type(TokenType type)
00090 {
00091         impl->type = type;
00092 }
00093 
00094 void CL_XMLTokenSave::set_variant(TokenVariant variant)
00095 {
00096         impl->variant = variant;
00097 }
00098 
00099 void CL_XMLTokenSave::set_name(const std::string &name)
00100 {
00101         impl->name = name;
00102 }
00103 
00104 void CL_XMLTokenSave::set_value(const std::string &value)
00105 {
00106         impl->value = value;
00107 }
00108 
00109 void CL_XMLTokenSave::set_attribute(const std::string &name, const std::string &value)
00110 {
00111         int size = impl->attributes.size();
00112         for (int i=0; i<size; i++)
00113         {
00114                 if (impl->attributes[i].first == name)
00115                 {
00116                         impl->attributes[i].second = value;
00117                         return;
00118                 }
00119         }
00120         impl->attributes.push_back(std::pair<std::string, std::string>(name, value));
00121 }
00122 
00124 // CL_XMLTokenSave implementation:

Generated on Sat Feb 19 22:51:16 2005 for npcore by  doxygen 1.4.1