summaryrefslogtreecommitdiff
path: root/project2/view.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/view.hpp')
-rw-r--r--project2/view.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/project2/view.hpp b/project2/view.hpp
new file mode 100644
index 0000000..be15eb5
--- /dev/null
+++ b/project2/view.hpp
@@ -0,0 +1,32 @@
+#include "view.h"
+
+template <class Driver>
+_GenericView<Driver>::_GenericView(const xmlpp::Element * p) :
+ _SourceObject(p),
+ _View(p),
+ Driver(p),
+ node(NULL)
+{
+}
+
+template <class Driver>
+void
+_GenericView<Driver>::execute(xmlpp::Element * e) const
+{
+ node = e->add_child(name);
+ Driver::execute();
+}
+
+template <class Driver>
+void
+_GenericView<Driver>::rowReady() const
+{
+ xmlpp::Element * record = node->add_child(recordName);
+ unsigned int cols = Driver::columnCount();
+ for (unsigned int col = 0; col < cols; col += 1) {
+ xmlpp::Element * ch = record->add_child(Driver::getColumnName(col));
+ ch->set_child_text(Driver::getCurrentValue(col));
+ }
+ executeChildren(record);
+}
+