changed to using getTemplates() instead of passing template param to FileReader
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -256,7 +255,7 @@ result_t DataField::create(vector<string>::iterator& it,
|
|||||||
else {
|
else {
|
||||||
istringstream stream(divisorStr);
|
istringstream stream(divisorStr);
|
||||||
while (getline(stream, token, VALUE_SEPARATOR) != 0) {
|
while (getline(stream, token, VALUE_SEPARATOR) != 0) {
|
||||||
DataFieldTemplates::trim(token);
|
FileReader::trim(token);
|
||||||
const char* str = token.c_str();
|
const char* str = token.c_str();
|
||||||
char* strEnd = NULL;
|
char* strEnd = NULL;
|
||||||
unsigned long int id;
|
unsigned long int id;
|
||||||
@@ -300,7 +299,7 @@ result_t DataField::create(vector<string>::iterator& it,
|
|||||||
bool firstType = true;
|
bool firstType = true;
|
||||||
istringstream stream(typeStr);
|
istringstream stream(typeStr);
|
||||||
while (result == RESULT_OK && getline(stream, token, VALUE_SEPARATOR) != 0) {
|
while (result == RESULT_OK && getline(stream, token, VALUE_SEPARATOR) != 0) {
|
||||||
DataFieldTemplates::trim(token);
|
FileReader::trim(token);
|
||||||
DataField* templ = templates->get(token);
|
DataField* templ = templates->get(token);
|
||||||
unsigned char length;
|
unsigned char length;
|
||||||
if (templ == NULL) {
|
if (templ == NULL) {
|
||||||
@@ -1517,7 +1516,7 @@ result_t DataFieldSet::write(istringstream& input,
|
|||||||
|
|
||||||
|
|
||||||
DataFieldTemplates::DataFieldTemplates(DataFieldTemplates& other)
|
DataFieldTemplates::DataFieldTemplates(DataFieldTemplates& other)
|
||||||
: FileReader<void*>::FileReader(false)
|
: FileReader::FileReader(false)
|
||||||
{
|
{
|
||||||
for (map<string, DataField*>::iterator it = other.m_fieldsByName.begin(); it != other.m_fieldsByName.end(); it++) {
|
for (map<string, DataField*>::iterator it = other.m_fieldsByName.begin(); it != other.m_fieldsByName.end(); it++) {
|
||||||
m_fieldsByName[it->first] = it->second->clone();
|
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<string>::iterator& begin, const vector<string>::iterator end,
|
result_t DataFieldTemplates::addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end,
|
||||||
void* arg, vector< vector<string> >* defaults,
|
vector< vector<string> >* defaults,
|
||||||
const string& filename, unsigned int lineNo)
|
const string& filename, unsigned int lineNo)
|
||||||
{
|
{
|
||||||
vector<string>::iterator restart = begin;
|
vector<string>::iterator restart = begin;
|
||||||
|
|||||||
+6
-4
@@ -53,7 +53,9 @@
|
|||||||
* @a istringstream to a @a SymbolString (see @a DataField#write()).
|
* @a istringstream to a @a SymbolString (see @a DataField#write()).
|
||||||
*
|
*
|
||||||
* The @a DataFieldTemplates allow definition of derived types as well as
|
* 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;
|
using namespace std;
|
||||||
@@ -811,14 +813,14 @@ private:
|
|||||||
/**
|
/**
|
||||||
* A map of template @a DataField instances.
|
* A map of template @a DataField instances.
|
||||||
*/
|
*/
|
||||||
class DataFieldTemplates : public FileReader<void*>
|
class DataFieldTemplates : public FileReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new instance.
|
* Constructs a new instance.
|
||||||
*/
|
*/
|
||||||
DataFieldTemplates() : FileReader<void*>::FileReader(false) {}
|
DataFieldTemplates() : FileReader::FileReader(false) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new copied instance.
|
* Constructs a new copied instance.
|
||||||
@@ -850,7 +852,7 @@ public:
|
|||||||
|
|
||||||
// @copydoc
|
// @copydoc
|
||||||
virtual result_t addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end,
|
virtual result_t addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end,
|
||||||
void* arg, vector< vector<string> >* defaults,
|
vector< vector<string> >* defaults,
|
||||||
const string& filename, unsigned int lineNo);
|
const string& filename, unsigned int lineNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user