summaryrefslogtreecommitdiff
path: root/project2/common/columns.h
diff options
context:
space:
mode:
Diffstat (limited to 'project2/common/columns.h')
-rw-r--r--project2/common/columns.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/project2/common/columns.h b/project2/common/columns.h
new file mode 100644
index 0000000..8b9b9b3
--- /dev/null
+++ b/project2/common/columns.h
@@ -0,0 +1,33 @@
+#ifndef COLUMNS_H
+#define COLUMNS_H
+
+#include <libxml++/nodes/element.h>
+#include "variables.h"
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+
+class Column : public IntrusivePtrBase {
+ public:
+ Column(unsigned int idx, const xmlpp::Element * p);
+ Column(unsigned int i, const Glib::ustring & n, const Variable & v = Variable(Null()));
+
+ static Column * make(unsigned int idx, const xmlpp::Element * p);
+
+ const unsigned int idx;
+ const Glib::ustring name;
+ const Variable defValue;
+};
+
+struct byColIdx {};
+struct byColName {};
+typedef boost::multi_index::multi_index_container<boost::intrusive_ptr<Column>,
+ boost::multi_index::indexed_by<
+ boost::multi_index::ordered_unique<
+ boost::multi_index::tag<byColName>, BOOST_MULTI_INDEX_MEMBER(Column, const Glib::ustring, name)>,
+ boost::multi_index::ordered_unique<
+ boost::multi_index::tag<byColIdx>, BOOST_MULTI_INDEX_MEMBER(Column, const unsigned int, idx)>
+ > > Columns;
+
+#endif
+