 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
38 const std::string& defDelim,
39 const std::string& lineDelim,
40 bool prune,
bool ignoreCase)
41 : myLineDelimiter(lineDelim), myAmCaseInsensitive(ignoreCase) {
51 const std::string& defDelim,
52 const std::string& lineDelim,
53 bool prune,
bool ignoreCase) {
77 int pos = (*i).second;
98 int pos = (*i).second;
111 const std::string& delim,
120 std::string next = st.
next();
122 myDefinitionsMap.insert(std::map<std::string, int>::value_type(next, pos++));
132 std::string::size_type idx = str.find_first_not_of(
" ");
133 if (idx != std::string::npos) {
134 str = str.substr(idx);
136 idx = str.find_last_not_of(
" ");
137 if (idx != std::string::npos && idx != str.length() - 1) {
138 str = str.substr(0, idx + 1);
bool hasFullDefinition() const
Returns whether the number of named columns matches the actual number.
bool hasNext()
returns the information whether further substrings exist
static std::string to_lower_case(std::string str)
Transfers the content to lower case.
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
void parseLine(const std::string &line)
Parses the contents of the line.
std::string myLineDelimiter
The delimiter to split the column items on.
std::string get(int pos) const
returns the item at the given position
std::string get(const std::string &name, bool prune=false) const
Returns the named information.
void reinitMap(std::string def, const std::string &delim=";", bool chomp=false)
Rebuilds the map of attribute names to their positions in a table.
void reinit(const std::string &def, const std::string &defDelim=";", const std::string &lineDelim=";", bool chomp=false, bool ignoreCase=true)
Reinitialises the parser.
int size() const
returns the number of existing substrings
bool know(const std::string &name) const
Returns the information whether the named column is known.
bool myAmCaseInsensitive
Information whether case insensitive match shall be done.
NamedColumnsParser()
Constructor.
~NamedColumnsParser()
Destructor.
PosMap myDefinitionsMap
The map of column item names to their positions within the table.
StringTokenizer myLineParser
The contents of the current line.
void checkPrune(std::string &str, bool prune) const
Prunes the given string if it shall be done.