/*
- Copyright (C) 2012 Paul Davis
+ Copyright (C) 2012 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
#include <string>
-#include <list>
+#include <vector>
#include <map>
#include <cstdio>
#include <cstdarg>
class XMLNode;
class XMLProperty;
-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;
+typedef std::vector<XMLNode *> XMLNodeList;
+typedef std::vector<boost::shared_ptr<XMLNode> > XMLSharedNodeList;
+typedef XMLNodeList::iterator XMLNodeIterator;
+typedef XMLNodeList::const_iterator XMLNodeConstIterator;
+typedef std::vector<XMLProperty*> XMLPropertyList;
+typedef XMLPropertyList::iterator XMLPropertyIterator;
+typedef XMLPropertyList::const_iterator XMLPropertyConstIterator;
+typedef std::map<std::string, XMLProperty*> XMLPropertyMap;
class LIBPBD_API XMLTree {
public:
private:
bool read_internal(bool validate);
-
+
std::string _filename;
XMLNode* _root;
xmlDocPtr _doc;
std::string attribute_value();
const XMLPropertyList& properties() const { return _proplist; }
- XMLProperty* property(const char*);
- XMLProperty* property(const std::string&);
- const XMLProperty* property(const char* n) const { return const_cast<XMLNode*>(this)->property(n); }
- const XMLProperty* property(const std::string& n) const { return const_cast<XMLNode*>(this)->property(n); }
-
+ XMLProperty const * property(const char*) const;
+ XMLProperty const * property(const std::string&) const;
+ XMLProperty * property(const char*);
+ XMLProperty * property(const std::string&);
+
+ bool has_property_with_value (const std::string&, const std::string&) const;
+
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);