diff options
Diffstat (limited to 'project2/definedColumns.h')
-rw-r--r-- | project2/definedColumns.h | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/project2/definedColumns.h b/project2/definedColumns.h index d6f2ba3..2fc6bbd 100644 --- a/project2/definedColumns.h +++ b/project2/definedColumns.h @@ -2,47 +2,26 @@ #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 <boost/foreach.hpp> #include "variables.h" #include "rowSet.h" +#include "columns.h" -class DefinedColumns : public RowSet { +class DefinedColumns { 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; + typedef boost::function2<Column *, unsigned int, const xmlpp::Element *> ColCreator; + DefinedColumns(const xmlpp::Element * p, const Glib::ustring & colPath, const ColCreator & func); + Columns columns; +}; + +class ColumnValues : public RowState { + public: + ColumnValues(const DefinedColumns *); + virtual ~ColumnValues(); + + virtual const Columns & getColumns() const; + + const DefinedColumns * const rowSet; }; #endif |