openModeller  Version 1.5.0
FileParser Class Reference

#include <FileParser.hh>

Collaboration diagram for FileParser:
Collaboration graph

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< ItemItemList
 
typedef std::pair< icstring,
std::string > 
Item
 
typedef std::vector< ItemItemList
 
typedef std::pair< icstring,
ItemList
Section
 
typedef std::vector< SectionSectionList
 

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
 

Detailed Description

Declaration of FileParser class.

Author
Mauro E S Muņoz mauro.nosp@m.@cri.nosp@m.a.org.nosp@m..br
Date
2003-09-25
Id:
FileParser.hh 5767 2013-07-16 17:25:12Z rdg

LICENSE INFORMATION

Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental

http://www.cria.org.br

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.

Author
Mauro E S Muņoz mauro.nosp@m.@cri.nosp@m.a.org.nosp@m..br
Date
2003-09-25
Id:
file_parser.hh 5679 2013-03-01 17:05:07Z rdg

LICENSE INFORMATION

Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental

http://www.cria.org.br

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.

Member Typedef Documentation

typedef std::pair<icstring,std::string> FileParser::Item
private

Definition at line 77 of file FileParser.hh.

typedef std::pair<icstring,std::string> FileParser::Item
private

Definition at line 84 of file my_file_parser.hh.

typedef std::vector<Item> FileParser::ItemList
private

Definition at line 78 of file FileParser.hh.

typedef std::vector<Item> FileParser::ItemList
private

Definition at line 85 of file my_file_parser.hh.

typedef std::pair<icstring,ItemList> FileParser::Section
private

Definition at line 86 of file my_file_parser.hh.

typedef std::vector<Section> FileParser::SectionList
private

Definition at line 87 of file my_file_parser.hh.

Constructor & Destructor Documentation

FileParser::FileParser ( const std::string &  file)

Definition at line 47 of file FileParser.cpp.

References error, and load().

Here is the call graph for this function:

FileParser::~FileParser ( )

Definition at line 61 of file FileParser.cpp.

FileParser::FileParser ( std::string const  file)

Definition at line 47 of file my_file_parser.cpp.

References error, and load().

Here is the call graph for this function:

FileParser::~FileParser ( )

Member Function Documentation

int FileParser::_count ( std::string const  key,
ItemList  lst 
) const
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().

std::string FileParser::_get ( std::string const  key,
ItemList  lst 
) const
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().

std::vector< std::string > FileParser::_getAll ( std::string const  key,
ItemList  lst 
) const
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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

std::string FileParser::get ( const std::string &  key) const
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.

References _get(), and f_lst.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

int FileParser::length ( ) const
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.

References f_lst, and f_seclst.

int FileParser::load ( const std::string &  file)

Definition at line 68 of file FileParser.cpp.

References f_lst.

Referenced by FileParser().

Member Data Documentation

ItemList FileParser::f_lst
private

Definition at line 80 of file FileParser.hh.

Referenced by count(), get(), getAll(), and load().

SectionList FileParser::f_seclst
private

Definition at line 90 of file my_file_parser.hh.

Referenced by count(), get(), getAll(), and load().


The documentation for this class was generated from the following files: