~vanvugt/+junk/mediatomb

« back to all changes in this revision

Viewing changes to src/mxml/element.h

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2008-03-02 13:09:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080302130916-zlljdze3kt7vuq4b
Tags: 0.11.0-1
* New upstream release.
* Include message about which inotify headers will be used when enabling
  inotify runtime support.
* Fixed error with use of INTERFACE in init script. Also removed use of -m
  option.
* Including new config.xml options.
* Added more build dependencies for new upstream release.
* Removed build dependency of libid3-dev, taglib is now preferred.
* mediatomb.xpm and manpage.xml is now included in orig tarball.
* inotify patch is not needed anymore.
* md5 patch has been committed upstream and is no longer needed. Also removed
  README.Debian.
* TwinHelix PNG fix is now used. Removed from TODO.
* Adding dependency of iceweasel for mediatomb package.
* Updated copyright file.
* Updated watch file.
* Updated rules file for proper configure options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
    Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
                       Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
9
9
    
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>
13
13
    
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.
26
26
    
27
 
    $Id: element.h 1294 2007-05-13 16:28:24Z lww $
 
27
    $Id: element.h 1709 2008-03-01 15:35:51Z lww $
28
28
*/
29
29
 
30
30
/// \file element.h
36
36
 
37
37
#include "mxml.h"
38
38
 
 
39
#include "node.h"
 
40
 
39
41
namespace mxml
40
42
{
41
43
 
42
 
class Element : public zmm::Object
 
44
class Element : public Node
43
45
{
44
 
public:
 
46
protected:
45
47
    zmm::String name;
46
 
    zmm::String text;
47
48
    zmm::Ref<zmm::Array<Attribute> > attributes;
48
 
    zmm::Ref<zmm::Array<Element> > children;
49
 
    zmm::Ref<Context> context;
50
 
 
 
49
    void addAttribute(zmm::Ref<Attribute> attr);
 
50
    void addAttribute(zmm::String name, zmm::String value);
 
51
    
51
52
public:
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();
59
58
 
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; }
62
61
 
63
 
    int childCount();
64
62
    int attributeCount();
65
 
    zmm::Ref<Element> getChild(int index);
66
63
    zmm::Ref<Attribute> getAttribute(int index);
67
64
        
68
 
    zmm::Ref<Element> getFirstChild();
69
 
 
70
 
    void appendChild(zmm::Ref<Element> child);
71
65
    void setText(zmm::String text);
72
66
 
 
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);
 
73
    
 
74
    void removeWhitespace();
 
75
    void indent(int level = 0);
 
76
    
 
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); }
 
80
    
 
81
    void removeElementChild(int index) { removeChild(index, mxml_node_element); }
 
82
    bool removeElementChild(zmm::String name, bool removeAll);
 
83
    
 
84
    void appendElementChild(zmm::Ref<Element> child) { appendChild(RefCast(child, Node)); };
73
85
    void appendTextChild(zmm::String name, zmm::String text);
74
 
    zmm::String print();
75
86
 
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);
78
90
    
79
91
protected:
80
 
    void print(zmm::Ref<zmm::StringBuffer> buf, int indent);
81
 
 
82
 
    static zmm::String escape(zmm::String str);
 
92
    virtual void print_internal(zmm::Ref<zmm::StringBuffer> buf, int indent);
 
93
    
 
94
    friend class Parser;
83
95
};
84
96
 
85
97