From 7cd55272353d9b4ce29123a9fec41ad79bb97c0b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 25 Jan 2015 19:02:36 +0000 Subject: Remove unrequired templating of objectrowstate --- p2pvr/daemon/maintenance/events.cpp | 2 +- p2pvr/lib/containerIterator.h | 2 +- p2pvr/lib/objectRowState.cpp | 23 +++++++++++++++++++++++ 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 rowState; + ObjectRowStateTmpl 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 rs; + ObjectRowStateTmpl 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 class ObjectRowState : public RowState { public: - ObjectRowState(const ColumnSpecifier & cs = CreateColumns) : - 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 +class ObjectRowStateTmpl : public ObjectRowState { + public: + ObjectRowStateTmpl(const ColumnSpecifier & cs = CreateColumns) : ObjectRowState(cs) {} +}; + #endif -- cgit v1.2.3