diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-25 19:02:36 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-13 17:29:48 +0100 |
commit | 7cd55272353d9b4ce29123a9fec41ad79bb97c0b (patch) | |
tree | 88aa3b9bf2d0bc3e089f2c19f074855feb6acd04 | |
parent | Return the select columns from CreateColumns and pass it back into BindColumn... (diff) | |
download | p2pvr-7cd55272353d9b4ce29123a9fec41ad79bb97c0b.tar.bz2 p2pvr-7cd55272353d9b4ce29123a9fec41ad79bb97c0b.tar.xz p2pvr-7cd55272353d9b4ce29123a9fec41ad79bb97c0b.zip |
Remove unrequired templating of objectrowstate
-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 |