dom_element.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 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 may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00031 
00032 #pragma once
00033 
00034 #include "../api_core.h"
00035 #include "dom_node.h"
00036 
00058 class CL_API_CORE CL_DomElement : public CL_DomNode
00059 {
00062 
00063 public:
00065         CL_DomElement();
00066 
00067         CL_DomElement(
00068                 CL_DomDocument &doc,
00069                 const CL_DomString &tag_name,
00070                 const CL_DomString &namespace_uri = CL_DomString());
00071 
00075         CL_DomElement(const CL_SharedPtr<CL_DomNode_Generic> &impl);
00076 
00077         ~CL_DomElement();
00078 
00082 
00083 public:
00085         CL_DomString get_tag_name() const;
00086 
00090 
00091 public:
00093         bool has_attribute(const CL_DomString &name) const;
00094 
00096         bool has_attribute_ns(
00097                 const CL_DomString &namespace_uri,
00098                 const CL_DomString &local_name) const;
00099 
00101         CL_DomString get_attribute(const CL_DomString &name) const;
00102 
00109         CL_DomString get_attribute(const CL_DomString &name, const CL_DomString &default_value) const;
00110 
00112         CL_DomString get_attribute_ns(
00113                 const CL_DomString &namespace_uri,
00114                 const CL_DomString &local_name) const;
00115 
00116         CL_DomString get_attribute_ns(
00117                 const CL_DomString &namespace_uri,
00118                 const CL_DomString &local_name,
00119                 const CL_DomString &default_value) const;
00120 
00122 
00130         void set_attribute(const CL_DomString &name, const CL_DomString &value);
00131 
00132         void set_attribute_ns(
00133                 const CL_DomString &namespace_uri,
00134                 const CL_DomString &qualified_name,
00135                 const CL_DomString &value);
00136 
00138 
00139         void remove_attribute(const CL_DomString &name);
00140 
00141         void remove_attribute_ns(
00142                 const CL_DomString &namespace_uri,
00143                 const CL_DomString &local_name);
00144 
00150         CL_DomAttr get_attribute_node(const CL_DomString &name) const;
00151 
00152         CL_DomAttr get_attribute_node_ns(
00153                 const CL_DomString &namespace_uri,
00154                 const CL_DomString &local_name) const;
00155 
00161         CL_DomAttr set_attribute_node(const CL_DomAttr &attr);
00162 
00168         CL_DomAttr set_attribute_node_ns(const CL_DomAttr &attr);
00169 
00171 
00173         CL_DomNodeList get_elements_by_tag_name(const CL_DomString &name);
00174 
00175         CL_DomNodeList get_elements_by_tag_name_ns(
00176                 const CL_DomString &namespace_uri,
00177                 const CL_DomString &local_name);
00178 
00180         CL_String get_text() const;
00181 
00183 
00184         CL_DomString get_child_string(const CL_DomString &name, const CL_DomString &default_value = CL_DomString()) const;
00185 
00187 
00188         CL_DomString get_child_string_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, const CL_DomString &default_value = CL_DomString()) const;
00189 
00191 
00192         int get_child_int(const CL_DomString &name, int default_value = 0) const;
00193 
00195 
00196         int get_child_int_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, int default_value = 0) const;
00197 
00199 
00200         bool get_child_bool(const CL_DomString &name, bool default_value = false) const;
00201 
00203 
00204         bool get_child_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, bool default_value = false) const;
00205 
00207 
00208         void set_child_string(const CL_DomString &name, const CL_DomString &value);
00209 
00211 
00212         void set_child_string_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, const CL_DomString &value);
00213 
00215 
00216         void set_child_int(const CL_DomString &name, int value);
00217 
00219 
00220         void set_child_int_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, int value);
00221 
00223 
00224         void set_child_bool(const CL_DomString &name, bool value);
00225 
00227 
00228         void set_child_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, bool value);
00229 
00231         CL_DomElement get_first_child_element() const;
00232 
00234         CL_DomElement get_next_sibling_element() const;
00235 
00237         int get_attribute_int(const CL_DomString &name, int default_value = 0) const;
00238 
00240         int get_attribute_int_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, int default_value = 0) const;
00241 
00243         bool get_attribute_bool(const CL_DomString &name, bool default_value = false) const;
00244 
00246         bool get_attribute_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, bool default_value = false) const;
00247 
00249         float get_attribute_float(const CL_DomString &name, float default_value = 0.0f) const;
00250 
00252         float get_attribute_float_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, float default_value = 0.0f) const;
00253 
00255         void set_attribute_int(const CL_DomString &name, int value);
00256 
00258         void set_attribute_int_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, int value);
00259 
00261         void set_attribute_bool(const CL_DomString &name, bool value);
00262 
00264         void set_attribute_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, bool value);
00265 
00267         void set_attribute_float(const CL_DomString &name, float value, int num_decimal_places = 6);
00268 
00270         void set_attribute_float_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, float value, int num_decimal_places = 6);
00272 };
00273