ParserToolbox.cc 1.83 KB
/*
 * 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 */