openModeller
Version 1.5.0
|
#include <FileParser.hh>
Public Member Functions | |
FileParser (const std::string &file) | |
~FileParser () | |
int | load (const std::string &file) |
std::string | get (const std::string &key) const |
int | count (const std::string &key) const |
std::vector< std::string > | getAll (const std::string &key) const |
int | length () const |
FileParser (std::string const file) | |
~FileParser () | |
int | load (std::string const file) |
std::string | get (std::string const key) const |
std::string | get (std::string const section, std::string const key) const |
int | count (std::string const key) const |
int | count (std::string const section, std::string const key) const |
std::vector< std::string > | getAll (std::string const key) const |
std::vector< std::string > | getAll (std::string const section, std::string const key) const |
Private Types | |
typedef std::pair< icstring, std::string > | Item |
typedef std::vector< Item > | ItemList |
typedef std::pair< icstring, std::string > | Item |
typedef std::vector< Item > | ItemList |
typedef std::pair< icstring, ItemList > | Section |
typedef std::vector< Section > | SectionList |
Private Member Functions | |
std::string | _get (std::string const key, ItemList lst) const |
int | _count (std::string const key, ItemList lst) const |
std::vector< std::string > | _getAll (std::string const key, ItemList lst) const |
Private Attributes | |
ItemList | f_lst |
SectionList | f_seclst |
Declaration of FileParser class.
LICENSE INFORMATION
Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:
http://www.gnu.org/copyleft/gpl.html Read key/value pairs from a configuration file.
Declaration of FileParser class.
LICENSE INFORMATION
Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:
http://www.gnu.org/copyleft/gpl.html Read key/value pairs from a configuration file.
Definition at line 42 of file FileParser.hh.
|
private |
Definition at line 77 of file FileParser.hh.
|
private |
Definition at line 84 of file my_file_parser.hh.
|
private |
Definition at line 78 of file FileParser.hh.
|
private |
Definition at line 85 of file my_file_parser.hh.
|
private |
Definition at line 86 of file my_file_parser.hh.
|
private |
Definition at line 87 of file my_file_parser.hh.
FileParser::FileParser | ( | const std::string & | file | ) |
FileParser::~FileParser | ( | ) |
Definition at line 61 of file FileParser.cpp.
FileParser::FileParser | ( | std::string const | file | ) |
FileParser::~FileParser | ( | ) |
|
private |
Return the number of times that a certain key appears on a list.
Definition at line 227 of file my_file_parser.cpp.
Referenced by count().
|
private |
Get the value of a key (case insensitive) from a list.
Definition at line 176 of file my_file_parser.cpp.
Referenced by get().
|
private |
Get a set of values with the same key from a list.
Definition at line 280 of file my_file_parser.cpp.
Referenced by getAll().
int FileParser::count | ( | const std::string & | key | ) | const |
Return the number of times that a certain key appears in the file.
Definition at line 165 of file FileParser.cpp.
References f_lst.
Referenced by Settings::count(), and main().
int FileParser::count | ( | std::string const | key | ) | const |
Return the number of times that a certain key appears under no section.
Definition at line 250 of file my_file_parser.cpp.
References _count(), and f_lst.
int FileParser::count | ( | std::string const | section, |
std::string const | key | ||
) | const |
Return the number of times that a certain key appears under a section.
Definition at line 259 of file my_file_parser.cpp.
References _count(), and f_seclst.
std::string FileParser::get | ( | const std::string & | key | ) | const |
Get the value of a key (case insensitive).
Definition at line 145 of file FileParser.cpp.
References f_lst.
Referenced by RequestFile::_setAlgorithm(), RequestFile::_setEnvironment(), RequestFile::_setOccurrences(), RequestFile::_setProjection(), RequestFile::configure(), Settings::get(), getLayerLabel(), and main().
std::string FileParser::get | ( | std::string const | key | ) | const |
Get the value of a key (case insensitive) under no section.
Definition at line 197 of file my_file_parser.cpp.
std::string FileParser::get | ( | std::string const | section, |
std::string const | key | ||
) | const |
Get the value of a key (case insensitive) under a section.
Definition at line 206 of file my_file_parser.cpp.
References _get(), and f_seclst.
std::vector< std::string > FileParser::getAll | ( | const std::string & | key | ) | const |
Get a set of values with the same key specified in the argument.
Definition at line 185 of file FileParser.cpp.
References f_lst.
Referenced by RequestFile::_setAlgorithm(), RequestFile::_setEnvironment(), RequestFile::_setProjection(), Settings::getAll(), and main().
std::vector< std::string > FileParser::getAll | ( | std::string const | key | ) | const |
Get a set of values with the same key under no section.
Definition at line 301 of file my_file_parser.cpp.
References _getAll(), and f_lst.
std::vector< std::string > FileParser::getAll | ( | std::string const | section, |
std::string const | key | ||
) | const |
Get a set of values with the same key under a section.
Definition at line 310 of file my_file_parser.cpp.
References _getAll(), and f_seclst.
|
inline |
Returns the number of lines in file.
Definition at line 70 of file FileParser.hh.
int FileParser::load | ( | std::string const | file | ) |
Definition at line 68 of file my_file_parser.cpp.
int FileParser::load | ( | const std::string & | file | ) |
|
private |
|
private |