Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
utils
CConfigFileMemory.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2012 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
#ifndef CConfigFileMemory_H
29
#define CConfigFileMemory_H
30
31
#include <
mrpt/utils/utils_defs.h
>
32
#include <
mrpt/utils/CConfigFileBase.h
>
33
#include <
mrpt/utils/CStringList.h
>
34
#include <
mrpt/utils/safe_pointers.h
>
35
36
/*---------------------------------------------------------------
37
Class
38
---------------------------------------------------------------*/
39
namespace
mrpt
40
{
41
namespace
utils
42
{
43
/** This class implements a config file-like interface over a memory-stored string list.
44
* \ingroup mrpt_base_grp
45
*/
46
class
BASE_IMPEXP
CConfigFileMemory
:
public
CConfigFileBase
47
{
48
private
:
49
/** The IniFile object
50
*/
51
void_ptr_noncopy
m_ini
;
52
53
protected
:
54
/** A virtual method to write a generic string.
55
*/
56
void
writeString(
const
std::string §ion,
const
std::string &name,
const
std::string &str);
57
58
/** A virtual method to read a generic string.
59
*/
60
std::string readString(
61
const
std::string §ion,
62
const
std::string &name,
63
const
std::string &defaultStr,
64
bool
failIfNotFound =
false
)
const
;
65
66
public
:
67
/** Constructor and initialize from a list of strings */
68
CConfigFileMemory
(
const
utils::CStringList
&stringList );
69
70
/** Constructor and initialize from string with the whole "config file" */
71
CConfigFileMemory
(
const
std::string &str );
72
73
/** Empty constructor. Upon construction, call any of the "setContent" method. */
74
CConfigFileMemory
();
75
76
/** Copy constructor */
77
CConfigFileMemory
(
const
CConfigFileMemory
& o);
78
79
/** Copy operator */
80
CConfigFileMemory
& operator = (
const
CConfigFileMemory
& o);
81
82
/** Changes the contents of the virtual "config file" */
83
void
setContent(
const
utils::CStringList
&stringList );
84
85
/** Changes the contents of the virtual "config file" */
86
void
setContent(
const
std::string &str );
87
88
/** Return the currnet contents of the virtual "config file" */
89
void
getContent( std::string &str )
const
;
90
91
/** Return the currnet contents of the virtual "config file" */
92
inline
std::string
getContent
()
const
{ std::string s;
getContent
(s);
return
s; }
93
94
/** Destructor
95
*/
96
virtual
~
CConfigFileMemory
( );
97
98
/** Returns a list with all the section names.
99
*/
100
virtual
void
getAllSections(
vector_string
§ions )
const
;
101
102
/** Returs a list with all the keys into a section.
103
*/
104
virtual
void
getAllKeys(
const
std::string section,
vector_string
&keys )
const
;
105
106
};
// End of class def.
107
108
}
// End of namespace
109
}
// end of namespace
110
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013