The object of TextParser class parses case, program and thread config files.
More...
#include <TextParser.h>
The object of TextParser class parses case, program and thread config files.
If verbose mode is true, the content of parsed files is printed on the console.
Definition at line 23 of file TextParser.h.
◆ TextParser()
MF::Parser::TextParser::TextParser |
( |
| ) |
|
|
default |
◆ ~TextParser()
MF::Parser::TextParser::~TextParser |
( |
| ) |
|
|
default |
◆ CaseConfigFileParse()
config4cpp::Configuration * MF::Parser::TextParser::CaseConfigFileParse |
( |
const char * |
pPathToCaseFile, |
|
|
const char * |
pScope, |
|
|
bool |
verbose |
|
) |
| |
Definition at line 12 of file TextParser.cpp.
14 config4cpp::StringVector namesVec;
15 config4cpp::StringVector namesList;
16 pCaseParams = config4cpp::Configuration::create();
19 setlocale(LC_ALL,
"en_US.UTF-8");
20 pCaseParams->parse(pPathToCaseFile);
21 std::cout <<
"Parsed file: -----> " << pPathToCaseFile << std::endl;
26 pCaseParams->listLocallyScopedNames(pScope,
"",config4cpp::Configuration::CFG_SCOPE_AND_VARS,
true, namesVec);
27 for (
int i = 0; i < namesVec.length(); i++)
28 if (pCaseParams->type(pScope,namesVec[i]) == pCaseParams->CFG_STRING)
29 std::cout <<
"\t"<< namesVec[i] <<
" = "<<pCaseParams->lookupString(pScope, namesVec[i])<< std::endl;
30 else if (pCaseParams->type(pScope,namesVec[i]) == pCaseParams->CFG_SCOPE)
31 std::cout << std::endl << namesVec[i] <<
":" << std::endl << std::endl;
32 else if (pCaseParams->type(pScope,namesVec[i]) == pCaseParams->CFG_LIST)
34 pCaseParams->lookupList(pScope, namesVec[i], namesList);
35 std::cout <<
"\t"<< namesVec[i] <<
" = [";
36 for (
int j = 0; j < namesList.length()-1; j++)
37 std::cout << namesList[j] <<
",";
38 std::cout << namesList[namesList.length()-1];
39 std::cout <<
"]"<< std::endl;
42 std::cout << namesVec[i] <<
" = " <<
"Unhandled format of data" << std::endl;
43 std::cout << std::endl;
45 }
catch(
const config4cpp::ConfigurationException &exception){std::cout <<
"File processing error "; std::cout << exception.c_str() << std::endl; exit(EXIT_FAILURE);}
◆ ProgramConfigFileParse()
config4cpp::Configuration * MF::Parser::TextParser::ProgramConfigFileParse |
( |
const char * |
pPathToConfigFile, |
|
|
const char * |
pScope, |
|
|
bool |
verbose |
|
) |
| |
Definition at line 49 of file TextParser.cpp.
51 config4cpp::StringVector namesVec;
52 config4cpp::StringVector namesList;
53 pProgramParams = config4cpp::Configuration::create();
56 setlocale(LC_ALL,
"en_US.UTF-8");
57 pProgramParams->parse(pPathToConfigFile);
58 std::cout <<
"Parsed file: -----> " << pPathToConfigFile << std::endl;
63 pProgramParams->listLocallyScopedNames(pScope,
"",config4cpp::Configuration::CFG_SCOPE_AND_VARS,
true, namesVec);
64 for (
int i = 0; i < namesVec.length(); i++)
65 if (pProgramParams->type(pScope,namesVec[i]) == pProgramParams->CFG_STRING)
66 std::cout <<
"\t"<< namesVec[i] <<
" = "<<pProgramParams->lookupString(pScope, namesVec[i])<< std::endl;
67 else if (pProgramParams->type(pScope,namesVec[i]) == pProgramParams->CFG_SCOPE)
68 std::cout << std::endl << namesVec[i] <<
":" << std::endl << std::endl;
69 else if (pProgramParams->type(pScope,namesVec[i]) == pProgramParams->CFG_LIST)
71 pProgramParams->lookupList(pScope, namesVec[i], namesList);
72 std::cout <<
"\t"<< namesVec[i] <<
" = [";
73 for (
int j = 0; j < namesList.length()-1; j++)
74 std::cout << namesList[j] <<
",";
75 std::cout << namesList[namesList.length()-1];
76 std::cout <<
"]"<< std::endl;
79 std::cout << namesVec[i] <<
" = " <<
"Unhandled format of data" << std::endl;
80 std::cout << std::endl;
82 }
catch(
const config4cpp::ConfigurationException &exception){std::cout <<
"File processing error "; std::cout << exception.c_str() << std::endl; exit(EXIT_FAILURE);}
83 return (pProgramParams);
◆ ThreadConfigFileParse()
config4cpp::Configuration * MF::Parser::TextParser::ThreadConfigFileParse |
( |
const char * |
pPathToThreadFile, |
|
|
const char * |
pScope, |
|
|
bool |
verbose |
|
) |
| |
Definition at line 86 of file TextParser.cpp.
88 config4cpp::StringVector namesVec;
89 config4cpp::StringVector namesList;
90 pThreadParams = config4cpp::Configuration::create();
93 setlocale(LC_ALL,
"en_US.UTF-8");
94 pThreadParams->parse(pPathToThreadFile);
95 std::cout <<
"Parsed file: -----> " << pPathToThreadFile << std::endl;
100 pThreadParams->listLocallyScopedNames(pScope,
"",config4cpp::Configuration::CFG_SCOPE_AND_VARS,
true, namesVec);
101 for (
int i = 0; i < namesVec.length(); i++)
102 if (pThreadParams->type(pScope,namesVec[i]) == pThreadParams->CFG_STRING)
103 std::cout <<
"\t"<< namesVec[i] <<
" = "<<pThreadParams->lookupString(pScope, namesVec[i])<< std::endl;
104 else if (pThreadParams->type(pScope,namesVec[i]) == pThreadParams->CFG_SCOPE)
105 std::cout << std::endl << namesVec[i] <<
":" << std::endl << std::endl;
106 else if (pThreadParams->type(pScope,namesVec[i]) == pThreadParams->CFG_LIST)
108 pThreadParams->lookupList(pScope, namesVec[i], namesList);
109 std::cout <<
"\t"<< namesVec[i] <<
" = [";
110 for (
int j = 0; j < namesList.length()-1; j++)
111 std::cout << namesList[j] <<
",";
112 std::cout << namesList[namesList.length()-1];
113 std::cout <<
"]"<< std::endl;
116 std::cout << namesVec[i] <<
" = " <<
"Unhandled format of data" << std::endl;
117 std::cout << std::endl;
119 }
catch(
const config4cpp::ConfigurationException &exception){std::cout <<
"File processing error "; std::cout << exception.c_str() << std::endl; exit(EXIT_FAILURE);}
120 return (pThreadParams);
The documentation for this class was generated from the following files:
- /home/romek/CLionProjects/Microflow_3D_v1/source/Parsers/TextParser.h
- /home/romek/CLionProjects/Microflow_3D_v1/source/Parsers/TextParser.cpp