Pick up effect and effect color.
[libdcp.git] / src / xml.h
index e5667b8f10a16db269e128dabe75a763f304ab91..9b6000131587b218f09564509d5cc31516be6db2 100644 (file)
--- a/src/xml.h
+++ b/src/xml.h
@@ -6,8 +6,10 @@
 #include <stdint.h>
 #include <glibmm.h>
 #include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
 #include "types.h"
 #include "exceptions.h"
+#include "dcp_time.h"
 
 namespace xmlpp {
        class Node;
@@ -33,6 +35,17 @@ protected:
        void ignore_node (std::string);
        void done ();
 
+       Time time_attribute (std::string);
+       float float_attribute (std::string);
+       std::string string_attribute (std::string);
+       std::string optional_string_attribute (std::string);
+       int64_t int64_attribute (std::string);
+       int64_t optional_int64_attribute (std::string);
+       boost::optional<bool> optional_bool_attribute (std::string);
+       boost::optional<Color> optional_color_attribute (std::string);
+
+       std::string content ();
+
        template <class T>
        boost::shared_ptr<T> sub_node (std::string name) {
                return boost::shared_ptr<T> (new T (xml_node (name)));
@@ -51,9 +64,8 @@ protected:
        }
        
        template <class T>
-       std::list<boost::shared_ptr<T> > sub_nodes (std::string name, std::string sub) {
-               XMLNode p (xml_node (name));
-               std::list<xmlpp::Node*> n = p.xml_nodes (sub);
+       std::list<boost::shared_ptr<T> > sub_nodes (std::string name) {
+               std::list<xmlpp::Node*> n = xml_nodes (name);
                std::list<boost::shared_ptr<T> > r;
                for (typename std::list<xmlpp::Node*>::iterator i = n.begin(); i != n.end(); ++i) {
                        r.push_back (boost::shared_ptr<T> (new T (*i)));
@@ -61,6 +73,12 @@ protected:
                return r;
        }
 
+       template <class T>
+       std::list<boost::shared_ptr<T> > sub_nodes (std::string name, std::string sub) {
+               XMLNode p (xml_node (name));
+               return p.sub_nodes<T> (sub);
+       }
+
        xmlpp::Node const * _node;
 
 private: