Last change
on this file since 4649 was
4597,
checked in by bensch, 19 years ago
|
orxonox/trunk: setClassID implemented in all files
|
File size:
1.0 KB
|
Line | |
---|
1 | /*! |
---|
2 | \file ini_parser.h |
---|
3 | \brief A small ini file parser |
---|
4 | |
---|
5 | Can be used to find a defined [Section] in an ini file and get the VarName=Value entries |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef _INI_PARSER_H |
---|
9 | #define _INI_PARSER_H |
---|
10 | |
---|
11 | #include <stdio.h> |
---|
12 | #include <string.h> |
---|
13 | #include <stdlib.h> |
---|
14 | #include "base_object.h" |
---|
15 | |
---|
16 | #define PARSELINELENGHT 512 //!< how many chars to read at once |
---|
17 | |
---|
18 | //! ini-file parser |
---|
19 | /** |
---|
20 | This class can be used to load an initializer file and parse it's contents for variablename=value pairs. |
---|
21 | */ |
---|
22 | class IniParser : public BaseObject |
---|
23 | { |
---|
24 | public: |
---|
25 | IniParser (const char* filename); |
---|
26 | ~IniParser (); |
---|
27 | |
---|
28 | char* getVar(const char* name, char* section, char* defvalue); |
---|
29 | int openFile(const char* name); |
---|
30 | int getSection( char* section); |
---|
31 | int nextVar( char* name, char* value); |
---|
32 | |
---|
33 | private: |
---|
34 | FILE* stream; //!< A FileStream to be loaded |
---|
35 | bool bInSection; //!< if the requested parameter is in the section. |
---|
36 | char internbuf[PARSELINELENGHT]; //!< a buffer |
---|
37 | |
---|
38 | |
---|
39 | }; |
---|
40 | |
---|
41 | #endif /* _INI_PARSER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.