diff options
Diffstat (limited to 'p2pvr/lib/objectRowState.h')
-rw-r--r-- | p2pvr/lib/objectRowState.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/p2pvr/lib/objectRowState.h b/p2pvr/lib/objectRowState.h index 945ea89..cf42055 100644 --- a/p2pvr/lib/objectRowState.h +++ b/p2pvr/lib/objectRowState.h @@ -6,6 +6,7 @@ #include <rowSet.h> typedef boost::function<void(const std::string &, bool)> ColumnCreator; +typedef boost::function<void(const ColumnCreator &)> ColumnSpecifier; template <typename V, typename... Parents> void BindColumns(RowState &, const V &, const Parents & ...); @@ -19,19 +20,19 @@ void CreateColumns(const ColumnCreator &); template <typename T> class ObjectRowState : public RowState { public: - ObjectRowState() : - columns(ColumnCreatorHelper()) + ObjectRowState(const ColumnSpecifier & cs = CreateColumns<T>) : + columns(ColumnCreatorHelper(cs)) { fields.resize(columns.size()); } const Columns & getColumns() const { return columns; } private: - static Columns ColumnCreatorHelper() + static Columns ColumnCreatorHelper(const ColumnSpecifier & cs) { int index = 0; Columns columns; - CreateColumns<T>([&columns, &index](const std::string & name, bool) { + cs([&columns, &index](const std::string & name, bool) { columns.insert(new Column(index++, name)); }); return columns; |