ClanLib  2.3.7
dom_element.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "../api_core.h"
35 #include "dom_node.h"
36 
59 {
62 
63 public:
65  CL_DomElement();
66 
68  CL_DomDocument &doc,
69  const CL_DomString &tag_name,
70  const CL_DomString &namespace_uri = CL_DomString());
71 
75  CL_DomElement(const CL_SharedPtr<CL_DomNode_Generic> &impl);
76 
77  ~CL_DomElement();
78 
82 
83 public:
85  CL_DomString get_tag_name() const;
86 
90 
91 public:
93  bool has_attribute(const CL_DomString &name) const;
94 
96  bool has_attribute_ns(
97  const CL_DomString &namespace_uri,
98  const CL_DomString &local_name) const;
99 
101  CL_DomString get_attribute(const CL_DomString &name) const;
102 
109  CL_DomString get_attribute(const CL_DomString &name, const CL_DomString &default_value) const;
110 
112  CL_DomString get_attribute_ns(
113  const CL_DomString &namespace_uri,
114  const CL_DomString &local_name) const;
115 
116  CL_DomString get_attribute_ns(
117  const CL_DomString &namespace_uri,
118  const CL_DomString &local_name,
119  const CL_DomString &default_value) const;
120 
122 
130  void set_attribute(const CL_DomString &name, const CL_DomString &value);
131 
132  void set_attribute_ns(
133  const CL_DomString &namespace_uri,
134  const CL_DomString &qualified_name,
135  const CL_DomString &value);
136 
138 
139  void remove_attribute(const CL_DomString &name);
140 
141  void remove_attribute_ns(
142  const CL_DomString &namespace_uri,
143  const CL_DomString &local_name);
144 
150  CL_DomAttr get_attribute_node(const CL_DomString &name) const;
151 
152  CL_DomAttr get_attribute_node_ns(
153  const CL_DomString &namespace_uri,
154  const CL_DomString &local_name) const;
155 
161  CL_DomAttr set_attribute_node(const CL_DomAttr &attr);
162 
168  CL_DomAttr set_attribute_node_ns(const CL_DomAttr &attr);
169 
171 
173  CL_DomNodeList get_elements_by_tag_name(const CL_DomString &name);
174 
175  CL_DomNodeList get_elements_by_tag_name_ns(
176  const CL_DomString &namespace_uri,
177  const CL_DomString &local_name);
178 
180  CL_String get_text() const;
181 
183 
184  CL_DomString get_child_string(const CL_DomString &name, const CL_DomString &default_value = CL_DomString()) const;
185 
187 
188  CL_DomString get_child_string_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, const CL_DomString &default_value = CL_DomString()) const;
189 
191 
192  int get_child_int(const CL_DomString &name, int default_value = 0) const;
193 
195 
196  int get_child_int_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, int default_value = 0) const;
197 
199 
200  bool get_child_bool(const CL_DomString &name, bool default_value = false) const;
201 
203 
204  bool get_child_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, bool default_value = false) const;
205 
207 
208  void set_child_string(const CL_DomString &name, const CL_DomString &value);
209 
211 
212  void set_child_string_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, const CL_DomString &value);
213 
215 
216  void set_child_int(const CL_DomString &name, int value);
217 
219 
220  void set_child_int_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, int value);
221 
223 
224  void set_child_bool(const CL_DomString &name, bool value);
225 
227 
228  void set_child_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, bool value);
229 
231  CL_DomElement get_first_child_element() const;
232 
234  CL_DomElement get_next_sibling_element() const;
235 
237  int get_attribute_int(const CL_DomString &name, int default_value = 0) const;
238 
240  int get_attribute_int_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, int default_value = 0) const;
241 
243  bool get_attribute_bool(const CL_DomString &name, bool default_value = false) const;
244 
246  bool get_attribute_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, bool default_value = false) const;
247 
249  float get_attribute_float(const CL_DomString &name, float default_value = 0.0f) const;
250 
252  float get_attribute_float_ns(const CL_DomString &namespace_uri, const CL_DomString &local_name, float default_value = 0.0f) const;
253 
255  void set_attribute_int(const CL_DomString &name, int value);
256 
258  void set_attribute_int_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, int value);
259 
261  void set_attribute_bool(const CL_DomString &name, bool value);
262 
264  void set_attribute_bool_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, bool value);
265 
267  void set_attribute_float(const CL_DomString &name, float value, int num_decimal_places = 6);
268 
270  void set_attribute_float_ns(const CL_DomString &namespace_uri, const CL_DomString &qualified_name, float value, int num_decimal_places = 6);
272 };
273