From 72396ff2f8b2655868603ebce160c5930287de16 Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 22 Nov 2015 09:31:15 +0100 Subject: [PATCH] changed to using getTemplates() instead of passing template param to FileReader --- src/lib/ebus/data.cpp | 9 ++++----- src/lib/ebus/data.h | 10 ++++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/lib/ebus/data.cpp b/src/lib/ebus/data.cpp index b61f4192..a9829e53 100644 --- a/src/lib/ebus/data.cpp +++ b/src/lib/ebus/data.cpp @@ -18,7 +18,6 @@ #include "data.h" #include -#include #include #include #include @@ -256,7 +255,7 @@ result_t DataField::create(vector::iterator& it, else { istringstream stream(divisorStr); while (getline(stream, token, VALUE_SEPARATOR) != 0) { - DataFieldTemplates::trim(token); + FileReader::trim(token); const char* str = token.c_str(); char* strEnd = NULL; unsigned long int id; @@ -300,7 +299,7 @@ result_t DataField::create(vector::iterator& it, bool firstType = true; istringstream stream(typeStr); while (result == RESULT_OK && getline(stream, token, VALUE_SEPARATOR) != 0) { - DataFieldTemplates::trim(token); + FileReader::trim(token); DataField* templ = templates->get(token); unsigned char length; if (templ == NULL) { @@ -1517,7 +1516,7 @@ result_t DataFieldSet::write(istringstream& input, DataFieldTemplates::DataFieldTemplates(DataFieldTemplates& other) - : FileReader::FileReader(false) + : FileReader::FileReader(false) { for (map::iterator it = other.m_fieldsByName.begin(); it != other.m_fieldsByName.end(); it++) { m_fieldsByName[it->first] = it->second->clone(); @@ -1554,7 +1553,7 @@ result_t DataFieldTemplates::add(DataField* field, string name, bool replace) } result_t DataFieldTemplates::addFromFile(vector::iterator& begin, const vector::iterator end, - void* arg, vector< vector >* defaults, + vector< vector >* defaults, const string& filename, unsigned int lineNo) { vector::iterator restart = begin; diff --git a/src/lib/ebus/data.h b/src/lib/ebus/data.h index 7668e95c..9caf758c 100644 --- a/src/lib/ebus/data.h +++ b/src/lib/ebus/data.h @@ -53,7 +53,9 @@ * @a istringstream to a @a SymbolString (see @a DataField#write()). * * The @a DataFieldTemplates allow definition of derived types as well as - * combined types based on the list of available base types. + * combined types based on the list of available base types. It reads the + * instances from configuration files by inheriting the @a FileReader template + * class. */ using namespace std; @@ -811,14 +813,14 @@ private: /** * A map of template @a DataField instances. */ -class DataFieldTemplates : public FileReader +class DataFieldTemplates : public FileReader { public: /** * Constructs a new instance. */ - DataFieldTemplates() : FileReader::FileReader(false) {} + DataFieldTemplates() : FileReader::FileReader(false) {} /** * Constructs a new copied instance. @@ -850,7 +852,7 @@ public: // @copydoc virtual result_t addFromFile(vector::iterator& begin, const vector::iterator end, - void* arg, vector< vector >* defaults, + vector< vector >* defaults, const string& filename, unsigned int lineNo); /**