summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/xml++.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/pbd/xml++.h')
-rw-r--r--libs/pbd/pbd/xml++.h90
1 files changed, 43 insertions, 47 deletions
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h
index 9427c7070c..65ab0f2c03 100644
--- a/libs/pbd/pbd/xml++.h
+++ b/libs/pbd/pbd/xml++.h
@@ -18,75 +18,71 @@
#ifndef __XML_H
#define __XML_H
-using std::string;
-using std::map;
-using std::list;
-
class XMLTree;
class XMLNode;
class XMLProperty;
-typedef list<XMLNode *> XMLNodeList;
-typedef list<boost::shared_ptr<XMLNode> > XMLSharedNodeList;
-typedef XMLNodeList::iterator XMLNodeIterator;
-typedef XMLNodeList::const_iterator XMLNodeConstIterator;
-typedef list<XMLProperty*> XMLPropertyList;
-typedef XMLPropertyList::iterator XMLPropertyIterator;
-typedef XMLPropertyList::const_iterator XMLPropertyConstIterator;
-typedef map<string, XMLProperty*> XMLPropertyMap;
+typedef std::list<XMLNode *> XMLNodeList;
+typedef std::list<boost::shared_ptr<XMLNode> > XMLSharedNodeList;
+typedef XMLNodeList::iterator XMLNodeIterator;
+typedef XMLNodeList::const_iterator XMLNodeConstIterator;
+typedef std::list<XMLProperty*> XMLPropertyList;
+typedef XMLPropertyList::iterator XMLPropertyIterator;
+typedef XMLPropertyList::const_iterator XMLPropertyConstIterator;
+typedef std::map<std::string, XMLProperty*> XMLPropertyMap;
class XMLTree {
public:
XMLTree();
- XMLTree(const string& fn, bool validate = false);
+ XMLTree(const std::string& fn, bool validate = false);
XMLTree(const XMLTree*);
~XMLTree();
XMLNode* root() const { return _root; }
XMLNode* set_root(XMLNode* n) { return _root = n; }
- const string& filename() const { return _filename; }
- const string& set_filename(const string& fn) { return _filename = fn; }
+ const std::string& filename() const { return _filename; }
+ const std::string& set_filename(const std::string& fn) { return _filename = fn; }
int compression() const { return _compression; }
int set_compression(int);
bool read() { return read_internal(false); }
- bool read(const string& fn) { set_filename(fn); return read_internal(false); }
+ bool read(const std::string& fn) { set_filename(fn); return read_internal(false); }
bool read_and_validate() { return read_internal(true); }
- bool read_and_validate(const string& fn) { set_filename(fn); return read_internal(true); }
- bool read_buffer(const string&);
+ bool read_and_validate(const std::string& fn) { set_filename(fn); return read_internal(true); }
+ bool read_buffer(const std::string&);
bool write() const;
- bool write(const string& fn) { set_filename(fn); return write(); }
+ bool write(const std::string& fn) { set_filename(fn); return write(); }
void debug (FILE*) const;
- const string& write_buffer() const;
+ const std::string& write_buffer() const;
private:
bool read_internal(bool validate);
- string _filename;
- XMLNode* _root;
- int _compression;
+ std::string _filename;
+ XMLNode* _root;
+ int _compression;
};
class XMLNode {
public:
- XMLNode(const string& name);
- XMLNode(const string& name, const string& content);
+ XMLNode(const std::string& name);
+ XMLNode(const std::string& name, const std::string& content);
XMLNode(const XMLNode& other);
~XMLNode();
- const string& name() const { return _name; }
+ const std::string& name() const { return _name; }
bool is_content() const { return _is_content; }
- const string& content() const { return _content; }
- const string& set_content(const string&);
- XMLNode* add_content(const string& s = string());
+ const std::string& content() const { return _content; }
+ const std::string& set_content(const std::string&);
+ XMLNode* add_content(const std::string& s = std::string());
- const XMLNodeList& children(const string& str = string()) const;
+ const XMLNodeList& children(const std::string& str = std::string()) const;
XMLNode* child(const char*) const;
XMLNode* add_child(const char *);
XMLNode* add_child_copy(const XMLNode&);
@@ -97,27 +93,27 @@ public:
const XMLPropertyList& properties() const { return _proplist; }
XMLProperty* property(const char*);
- XMLProperty* property(const string&);
+ XMLProperty* property(const std::string&);
const XMLProperty* property(const char* n) const { return ((XMLNode*)this)->property(n); }
- const XMLProperty* property(const string& n) const { return ((XMLNode*)this)->property(n); }
+ const XMLProperty* property(const std::string& n) const { return ((XMLNode*)this)->property(n); }
- XMLProperty* add_property(const char* name, const string& value);
+ XMLProperty* add_property(const char* name, const std::string& value);
XMLProperty* add_property(const char* name, const char* value = "");
XMLProperty* add_property(const char* name, const long value);
- void remove_property(const string&);
+ void remove_property(const std::string&);
/** Remove all nodes with the name passed to remove_nodes */
- void remove_nodes(const string&);
+ void remove_nodes(const std::string&);
/** Remove and delete all nodes with the name passed to remove_nodes */
- void remove_nodes_and_delete(const string&);
+ void remove_nodes_and_delete(const std::string&);
/** Remove and delete all nodes with property prop matching val */
- void remove_nodes_and_delete(const string& propname, const string& val);
+ void remove_nodes_and_delete(const std::string& propname, const std::string& val);
private:
- string _name;
+ std::string _name;
bool _is_content;
- string _content;
+ std::string _content;
XMLNodeList _children;
XMLPropertyList _proplist;
XMLPropertyMap _propmap;
@@ -126,27 +122,27 @@ private:
class XMLProperty {
public:
- XMLProperty(const string& n, const string& v = string());
+ XMLProperty(const std::string& n, const std::string& v = std::string());
~XMLProperty();
- const string& name() const { return _name; }
- const string& value() const { return _value; }
- const string& set_value(const string& v) { return _value = v; }
+ const std::string& name() const { return _name; }
+ const std::string& value() const { return _value; }
+ const std::string& set_value(const std::string& v) { return _value = v; }
private:
- string _name;
- string _value;
+ std::string _name;
+ std::string _value;
};
class XMLException: public std::exception {
public:
- explicit XMLException(const string msg) : _message(msg) {}
+ explicit XMLException(const std::string msg) : _message(msg) {}
virtual ~XMLException() throw() {}
virtual const char* what() const throw() { return _message.c_str(); }
private:
- string _message;
+ std::string _message;
};
#endif /* __XML_H */