diff options
-rw-r--r-- | p2pvr/daemon/maintenance/events.cpp | 2 | ||||
-rw-r--r-- | p2pvr/lib/containerIterator.h | 2 | ||||
-rw-r--r-- | p2pvr/lib/objectRowState.cpp | 23 | ||||
-rw-r--r-- | p2pvr/lib/objectRowState.h | 25 |
4 files changed, 34 insertions, 18 deletions
diff --git a/p2pvr/daemon/maintenance/events.cpp b/p2pvr/daemon/maintenance/events.cpp index 8c0834b..e9c6be7 100644 --- a/p2pvr/daemon/maintenance/events.cpp +++ b/p2pvr/daemon/maintenance/events.cpp @@ -27,7 +27,7 @@ class SiEventsHandler : public SiEpgParser { } private: - ObjectRowState<DVBSI::EventPtr> rowState; + ObjectRowStateTmpl<DVBSI::EventPtr> rowState; const SelectedColumns & ecs; const RowProcessorCallback callBack; }; diff --git a/p2pvr/lib/containerIterator.h b/p2pvr/lib/containerIterator.h index dac2639..14c339d 100644 --- a/p2pvr/lib/containerIterator.h +++ b/p2pvr/lib/containerIterator.h @@ -17,7 +17,7 @@ class ContainerIterator : public IHaveSubTasks { void execute(ExecContext * ec) const { - ObjectRowState<typename T::value_type> rs; + ObjectRowStateTmpl<typename T::value_type> rs; for (const auto & i : *container) { binder(rs, i); rs.process(boost::bind(&ContainerIterator::executeChildren, this, ec)); diff --git a/p2pvr/lib/objectRowState.cpp b/p2pvr/lib/objectRowState.cpp index 3f04cda..89e5ac8 100644 --- a/p2pvr/lib/objectRowState.cpp +++ b/p2pvr/lib/objectRowState.cpp @@ -64,3 +64,26 @@ BindColumns(Slicer::ModelPartPtr mp, const SelectedColumns & sc, RowState & rs) }); } +ObjectRowState::ObjectRowState(const ColumnSpecifier & cs) : + columns(ColumnCreatorHelper(cs)) +{ + fields.resize(columns.size()); +} + +const Columns & +ObjectRowState::getColumns() const +{ + return columns; +} + +Columns +ObjectRowState::ColumnCreatorHelper(const ColumnSpecifier & cs) +{ + int index = 0; + Columns columns; + cs([&columns, &index](const std::string & name, bool) { + columns.insert(new Column(index++, name)); + }); + return columns; +} + diff --git a/p2pvr/lib/objectRowState.h b/p2pvr/lib/objectRowState.h index 142e5cb..3e3fd2f 100644 --- a/p2pvr/lib/objectRowState.h +++ b/p2pvr/lib/objectRowState.h @@ -27,29 +27,22 @@ SelectedColumns CreateColumns(const ColumnCreator & cc) return CreateColumns(Slicer::ModelPartFor(v), cc); } -template <typename T> class ObjectRowState : public RowState { public: - ObjectRowState(const ColumnSpecifier & cs = CreateColumns<T>) : - columns(ColumnCreatorHelper(cs)) - { - fields.resize(columns.size()); - } - const Columns & getColumns() const { return columns; } + ObjectRowState(const ColumnSpecifier & cs); + const Columns & getColumns() const; private: - static Columns ColumnCreatorHelper(const ColumnSpecifier & cs) - { - int index = 0; - Columns columns; - cs([&columns, &index](const std::string & name, bool) { - columns.insert(new Column(index++, name)); - }); - return columns; - } + static Columns ColumnCreatorHelper(const ColumnSpecifier & cs); Columns columns; }; +template <typename T> +class ObjectRowStateTmpl : public ObjectRowState { + public: + ObjectRowStateTmpl(const ColumnSpecifier & cs = CreateColumns<T>) : ObjectRowState(cs) {} +}; + #endif |