summaryrefslogtreecommitdiff
path: root/xml-base.h
blob: 663c7fc1b6f01f5e9c0840081ffed9f6771740b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * xml-base.h
 */

#ifndef __XML_BASE_H
#define __XML_BASE_H

#include <tinyxml.h>

#include <string>


class cXmlBase {
private:
        std::string path, root_element;

        TiXmlDocument *document;
        TiXmlElement *root;
protected:
        virtual ~cXmlBase();

        virtual void copy_to_objects(void) {}
public:
     cXmlBase(const char *_root_element);

        bool load(const std::string &_path);
        void clear(void);

        void add_subelement(TiXmlElement &main_element,
                const char *name, const std::string &text);

        TiXmlDocument *get_document(void) { return document; }
        TiXmlElement *get_root(void) { return root; }
        void set_root(void);
};

#endif /* __XML_BASE_H */