extracted method readConditions()
This commit is contained in:
@@ -849,13 +849,8 @@ result_t MessageMap::addDefaultFromFile(vector< vector<string> >& defaults, vect
|
|||||||
return FileReader::addDefaultFromFile(defaults, row, begin, defaultDest, defaultCircuit, filename, lineNo);
|
return FileReader::addDefaultFromFile(defaults, row, begin, defaultDest, defaultCircuit, filename, lineNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end,
|
result_t MessageMap::readConditions(string& types, const string& filename, Condition*& condition)
|
||||||
DataFieldTemplates* arg, vector< vector<string> >* defaults,
|
|
||||||
const string& filename, unsigned int lineNo)
|
|
||||||
{
|
{
|
||||||
vector<string>::iterator restart = begin;
|
|
||||||
Condition* condition = NULL;
|
|
||||||
string types = *restart;
|
|
||||||
size_t pos;
|
size_t pos;
|
||||||
if (types.length()>0 && types[0]=='[' && (pos=types.find_last_of(']'))!=string::npos) {
|
if (types.length()>0 && types[0]=='[' && (pos=types.find_last_of(']'))!=string::npos) {
|
||||||
// check if combined or simple condition is already known
|
// check if combined or simple condition is already known
|
||||||
@@ -886,13 +881,26 @@ result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end,
|
||||||
|
DataFieldTemplates* arg, vector< vector<string> >* defaults,
|
||||||
|
const string& filename, unsigned int lineNo)
|
||||||
|
{
|
||||||
|
vector<string>::iterator restart = begin;
|
||||||
|
string types = *restart;
|
||||||
|
Condition* condition = NULL;
|
||||||
|
result_t result = readConditions(types, filename, condition);
|
||||||
|
if (result!=RESULT_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
if (types.length() == 0)
|
if (types.length() == 0)
|
||||||
types.append("r");
|
types.append("r");
|
||||||
else if (types.find(']')!=string::npos)
|
else if (types.find(']')!=string::npos)
|
||||||
return RESULT_ERR_INVALID_ARG;
|
return RESULT_ERR_INVALID_ARG;
|
||||||
|
|
||||||
result_t result = RESULT_ERR_EOF;
|
result = RESULT_ERR_EOF;
|
||||||
istringstream stream(types);
|
istringstream stream(types);
|
||||||
string type;
|
string type;
|
||||||
vector<Message*> messages;
|
vector<Message*> messages;
|
||||||
|
|||||||
@@ -606,6 +606,14 @@ public:
|
|||||||
vector<string>::iterator& begin, string defaultDest, string defaultCircuit,
|
vector<string>::iterator& begin, string defaultDest, string defaultCircuit,
|
||||||
const string& filename, unsigned int lineNo);
|
const string& filename, unsigned int lineNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the @a Condition instance(s) from the types field.
|
||||||
|
* @param types the field from which to read the @a Condition instance(s).
|
||||||
|
* @param filename the name of the file being read.
|
||||||
|
* @param returnValue the variable in which to store the read instance.
|
||||||
|
*/
|
||||||
|
result_t readConditions(string& types, const string& filename, Condition*& condition);
|
||||||
|
|
||||||
// @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,
|
||||||
DataFieldTemplates* arg, vector< vector<string> >* defaults,
|
DataFieldTemplates* arg, vector< vector<string> >* defaults,
|
||||||
|
|||||||
Reference in New Issue
Block a user