summaryrefslogtreecommitdiff
path: root/project2/definedColumns.h
diff options
context:
space:
mode:
Diffstat (limited to 'project2/definedColumns.h')
-rw-r--r--project2/definedColumns.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/project2/definedColumns.h b/project2/definedColumns.h
new file mode 100644
index 0000000..d6f2ba3
--- /dev/null
+++ b/project2/definedColumns.h
@@ -0,0 +1,50 @@
+#ifndef DEFINEDCOLUMNS_H
+#define DEFINEDCOLUMNS_H
+
+#include <libxml++/nodes/element.h>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include "variables.h"
+#include "rowSet.h"
+
+class DefinedColumns : public RowSet {
+ public:
+ DefinedColumns(const xmlpp::Element *);
+
+ unsigned int columnCount() const;
+ const Glib::ustring & getColumnName(unsigned int col) const;
+ VariableType getCurrentValue(const Glib::ustring & id) const;
+ VariableType getCurrentValue(unsigned int col) const;
+ bool isNull(unsigned int col) const;
+ bool isNull(const Glib::ustring & id) const;
+
+ protected:
+ class Column {
+ public:
+ Column(unsigned int idx, const Glib::ustring &);
+ Column(unsigned int idx, const xmlpp::Element * p);
+
+ void operator=(const VariableType &) const;
+
+ const unsigned int idx;
+ const Glib::ustring col;
+ mutable VariableType value;
+ const Variable defValue;
+ };
+ struct byColIdx {};
+ struct byColName {};
+ typedef boost::multi_index::multi_index_container<
+ Column,
+ boost::multi_index::indexed_by<
+ boost::multi_index::ordered_unique<
+ boost::multi_index::tag<byColName>, BOOST_MULTI_INDEX_MEMBER(Column, const Glib::ustring, col)>,
+ boost::multi_index::ordered_unique<
+ boost::multi_index::tag<byColIdx>, BOOST_MULTI_INDEX_MEMBER(Column, const unsigned int, idx)>
+ > > Columns;
+ mutable Columns columns;
+};
+
+#endif
+
+