ParserToolbox.cc
1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* ParserToolbox.cc
*
* Created on: Mar 18, 2019
* Author: AKKA
*/
#include "ParserToolbox.hh"
#include "Helper.hh"
#include "ConstantsParser.hh"
#include "FunctionsParser.hh"
#include "FunctionsArgsListParser.hh"
#include "TemplateParamsParser.hh"
namespace AMDA {
namespace parser {
std::vector<std::string> ParserToolbox::getParameters(AMDA::helpers::Properties& lProperties) {
std::vector<std::string> files = std::vector<std::string>();
AMDA::Helpers::Helper::getMatchFiles(lProperties["app.param.path"].c_str(), files, ".*.xml$");
std::vector<std::string> parameters = std::vector<std::string>();
for (std::vector<std::string>::iterator it = files.begin(); it != files.end(); ++it) {
size_t lastindex = (*it).find_last_of(".");
parameters.push_back((*it).substr(0, lastindex));
}
return parameters;
}
std::map<std::string, std::string> ParserToolbox::getConstants(AMDA::helpers::Properties& lProperties) {
AMDA::parser::ConstantsParser parser(lProperties["app.ihmConstants.xsd"].c_str());
return parser.parse(lProperties["app.ihmConstants.xml"]);
}
FunctionInfoMap ParserToolbox::getFunctions(AMDA::helpers::Properties& lProperties) {
AMDA::parser::FunctionsParser parser(lProperties["app.ihmFunctions.xsd"].c_str());
return parser.parse(lProperties["app.ihmFunctions.xml"]);
}
ArgListInfoMap ParserToolbox::getArgsLists(AMDA::helpers::Properties& lProperties) {
AMDA::parser::FunctionsArgsListParser parser(lProperties["app.ihmFunctionsArgsList.xsd"].c_str());
return parser.parse(lProperties["app.ihmFunctionsArgsList.xml"]);
}
TemplateParamsList ParserToolbox::getTemplateParams(AMDA::helpers::Properties& lProperties) {
AMDA::parser::TemplateParamsParser parser(lProperties["app.ihmTemplateParams.xsd"].c_str());
return parser.parse(lProperties["app.ihmTemplateParams.xml"]);
}
} /* namespace parser */
} /* namespace AMDA */