7
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2007 Gena Batyan <bgeradz@mediatomb.cc>,
10
Copyright (C) 2006-2008 Gena Batyan <bgeradz@mediatomb.cc>,
11
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
12
Leonhard Wimmer <leo@mediatomb.cc>
24
24
version 2 along with MediaTomb; if not, write to the Free Software
25
25
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
27
$Id: element.h 1294 2007-05-13 16:28:24Z lww $
27
$Id: element.h 1709 2008-03-01 15:35:51Z lww $
30
30
/// \file element.h
42
class Element : public zmm::Object
44
class Element : public Node
47
48
zmm::Ref<zmm::Array<Attribute> > attributes;
48
zmm::Ref<zmm::Array<Element> > children;
49
zmm::Ref<Context> context;
49
void addAttribute(zmm::Ref<Attribute> attr);
50
void addAttribute(zmm::String name, zmm::String value);
52
53
Element(zmm::String name);
53
54
Element(zmm::String name, zmm::Ref<Context> context);
54
55
zmm::String getAttribute(zmm::String name);
55
void addAttribute(zmm::Ref<Attribute> attr);
56
void addAttribute(zmm::String name, zmm::String value);
57
56
void setAttribute(zmm::String name, zmm::String value);
58
57
zmm::String getText();
60
zmm::String getName();
61
void setName(zmm::String name);
59
inline zmm::String getName() { return name; }
60
void setName(zmm::String name) { this->name = name; }
64
62
int attributeCount();
65
zmm::Ref<Element> getChild(int index);
66
63
zmm::Ref<Attribute> getAttribute(int index);
68
zmm::Ref<Element> getFirstChild();
70
void appendChild(zmm::Ref<Element> child);
71
65
void setText(zmm::String text);
67
int childCount(enum mxml_node_types type = mxml_node_all);
68
zmm::Ref<Node> getChild(int index, enum mxml_node_types type = mxml_node_all, bool remove = false);
69
zmm::Ref<Node> getFirstChild(enum mxml_node_types type = mxml_node_all) { return getChild(0, type); }
70
void removeChild(int index, enum mxml_node_types type = mxml_node_all);
71
void appendChild(zmm::Ref<Node> child);
72
void insertChild(int index, zmm::Ref<Node> child);
74
void removeWhitespace();
75
void indent(int level = 0);
77
zmm::Ref<Element> getFirstElementChild() { return getElementChild(0); }
78
zmm::Ref<Element> getElementChild(int index) { return RefCast(getChild(index, mxml_node_element), Element); }
79
int elementChildCount() { return childCount(mxml_node_element); }
81
void removeElementChild(int index) { removeChild(index, mxml_node_element); }
82
bool removeElementChild(zmm::String name, bool removeAll);
84
void appendElementChild(zmm::Ref<Element> child) { appendChild(RefCast(child, Node)); };
73
85
void appendTextChild(zmm::String name, zmm::String text);
76
zmm::Ref<Element> getChild(zmm::String name);
87
int getChildIdByName(zmm::String name);
88
zmm::Ref<Element> getChildByName(zmm::String name);
77
89
zmm::String getChildText(zmm::String name);
80
void print(zmm::Ref<zmm::StringBuffer> buf, int indent);
82
static zmm::String escape(zmm::String str);
92
virtual void print_internal(zmm::Ref<zmm::StringBuffer> buf, int indent);