#include <ParsedParameterLine.h>
|
static int | makeParsedStrings (const std::string &line, std::vector< std::string > &fillThisList) |
|
|
static const std::string | _commentStart ="//" |
|
static const std::string | _testString =" \"para Name\" 78 70 80 90 100 101 10 11 12\\\\ comment " |
|
static const std::string | _testName ="para Name" |
|
Definition at line 13 of file ParsedParameterLine.h.
◆ ParsedParameterLine() [1/2]
MINT::ParsedParameterLine::ParsedParameterLine |
( |
const std::string & |
line = "" | ) |
|
|
inline |
Definition at line 37 of file ParsedParameterLine.h.
std::vector< std::string > _parsedStrings
static int makeParsedStrings(const std::string &line, std::vector< std::string > &fillThisList)
◆ ParsedParameterLine() [2/2]
◆ ~ParsedParameterLine()
virtual MINT::ParsedParameterLine::~ParsedParameterLine |
( |
| ) |
|
|
inlinevirtual |
◆ isBlank()
bool ParsedParameterLine::isBlank |
( |
char |
c | ) |
|
|
static |
◆ isValid()
bool ParsedParameterLine::isValid |
( |
| ) |
const |
Definition at line 64 of file ParsedParameterLine.cpp.
std::vector< std::string > _parsedStrings
virtual const std::string & name() const
◆ makeParsedStrings() [1/2]
int ParsedParameterLine::makeParsedStrings |
( |
const std::string & |
line, |
|
|
std::vector< std::string > & |
fillThisList |
|
) |
| |
|
staticprotected |
Definition at line 68 of file ParsedParameterLine.cpp.
76 if(
s.empty())
return 0;
80 string::const_iterator prev=
s.begin();
82 bool insideQuotes=
false;
92 for(string::const_iterator it=
s.begin();
95 if( ((! insideQuotes) &&
isBlank(*it)) || *it ==
'"' || ignore){
97 string tmp_s(prev, it);
98 fillThisList.push_back(tmp_s);
102 if(prevBlank) prev=it;
106 if(*it ==
'"') insideQuotes = ! insideQuotes;
109 cout <<
"WARNING in ParsedParameterLine::makeParsedStrings \n" 110 <<
" unbalanced quotes in string:\n" 113 return fillThisList.size();
static std::string removeComment(const std::string &line)
static std::string removeTrailingBlanks(const std::string &s)
static std::string removeLeadingBlanks(const std::string &s)
static bool isBlank(char c)
◆ makeParsedStrings() [2/2]
bool ParsedParameterLine::makeParsedStrings |
( |
const std::string & |
line | ) |
|
|
protectedvirtual |
Definition at line 116 of file ParsedParameterLine.cpp.
std::vector< std::string > _parsedStrings
static int makeParsedStrings(const std::string &line, std::vector< std::string > &fillThisList)
◆ name()
virtual const std::string& MINT::ParsedParameterLine::name |
( |
| ) |
const |
|
inlinevirtual |
◆ parsedStrings()
const std::vector<std::string>& MINT::ParsedParameterLine::parsedStrings |
( |
| ) |
const |
|
inline |
◆ print()
void ParsedParameterLine::print |
( |
std::ostream & |
os = std::cout | ) |
const |
|
virtual |
◆ removeComment()
string ParsedParameterLine::removeComment |
( |
const std::string & |
line | ) |
|
|
static |
Definition at line 49 of file ParsedParameterLine.cpp.
50 if(s_in.empty())
return s_in;
54 if(commentStart >= 0 && commentStart < (
int)
s.size()){
55 s.resize(commentStart);
static const std::string _commentStart
◆ removeCommentAndLeadingBlanks()
string ParsedParameterLine::removeCommentAndLeadingBlanks |
( |
const std::string & |
line | ) |
|
|
static |
Definition at line 60 of file ParsedParameterLine.cpp.
static std::string removeComment(const std::string &line)
static std::string removeLeadingBlanks(const std::string &s)
◆ removeLeadingAndTrailingBlanks()
std::string ParsedParameterLine::removeLeadingAndTrailingBlanks |
( |
const std::string & |
s | ) |
|
|
static |
Definition at line 45 of file ParsedParameterLine.cpp.
static std::string removeTrailingBlanks(const std::string &s)
static std::string removeLeadingBlanks(const std::string &s)
◆ removeLeadingBlanks()
std::string ParsedParameterLine::removeLeadingBlanks |
( |
const std::string & |
s | ) |
|
|
static |
Definition at line 22 of file ParsedParameterLine.cpp.
23 if(
s.empty())
return s;
24 std::string::const_iterator firstNonBlank=
s.begin();
25 for(firstNonBlank=
s.begin();
26 firstNonBlank !=
s.end() && (
isBlank(*firstNonBlank));
30 string new_s(firstNonBlank,
s.end());
static bool isBlank(char c)
◆ removeTrailingBlanks()
std::string ParsedParameterLine::removeTrailingBlanks |
( |
const std::string & |
s | ) |
|
|
static |
Definition at line 33 of file ParsedParameterLine.cpp.
34 if(
s.empty())
return s;
35 std::string::const_iterator lastNonBlank =
s.end();
36 for(string::const_iterator it=
s.begin();
38 if(!
isBlank(*it)) lastNonBlank = it;
40 if(lastNonBlank !=
s.end()) lastNonBlank++;
42 string new_s(
s.begin(), lastNonBlank);
static bool isBlank(char c)
◆ stringParsingTest()
void ParsedParameterLine::stringParsingTest |
( |
std::ostream & |
os = std::cout | ) |
const |
|
virtual |
Definition at line 128 of file ParsedParameterLine.cpp.
129 os <<
"Testing the String Parsing in ParsedParameterLine:" << endl;
130 os <<
" test string is (w/o the '>' and '<'):\n" 133 os <<
" ... removing leading blanks gives:\n" 134 <<
" >" << noBlanks <<
"<" << endl;
135 os <<
" ... removing trailing blanks gives:\n" 138 os <<
" ... string without comment:\n" 139 <<
" >" << noComment <<
"<" 141 os <<
" ... string without comment run through removeComment again:\n" 144 os <<
" ... removeCommentAndLeadingBlanks\n" 148 vector<string> valueStringList;
150 os <<
" made value string list:\n";
151 for(
unsigned int i=0; i< valueStringList.size(); i++){
152 os <<
" " << i <<
") >" << valueStringList[i] <<
"< " << endl;
154 os <<
"test done." << endl;
static std::string removeCommentAndLeadingBlanks(const std::string &line)
static std::string removeComment(const std::string &line)
static int makeParsedStrings(const std::string &line, std::vector< std::string > &fillThisList)
static std::string removeTrailingBlanks(const std::string &s)
static std::string removeLeadingBlanks(const std::string &s)
static const std::string _testString
◆ _commentStart
const std::string ParsedParameterLine::_commentStart ="//" |
|
staticprotected |
◆ _name
std::string MINT::ParsedParameterLine::_name |
|
protected |
◆ _parsedStrings
std::vector<std::string> MINT::ParsedParameterLine::_parsedStrings |
|
protected |
◆ _testName
const std::string ParsedParameterLine::_testName ="para Name" |
|
staticprotected |
◆ _testString
const std::string ParsedParameterLine::_testString =" \"para Name\" 78 70 80 90 100 101 10 11 12\\\\ comment " |
|
staticprotected |
The documentation for this class was generated from the following files: