Last change
on this file since 4559 was
4482,
checked in by bensch, 19 years ago
|
orxonox/trunk: lib/util: doxy-tags
|
File size:
1013 bytes
|
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 | |
---|
15 | #define PARSELINELENGHT 512 //!< how many chars to read at once |
---|
16 | |
---|
17 | //! ini-file parser |
---|
18 | /** |
---|
19 | This class can be used to load an initializer file and parse it's contents for variablename=value pairs. |
---|
20 | */ |
---|
21 | class IniParser { |
---|
22 | public: |
---|
23 | IniParser (const char* filename); |
---|
24 | ~IniParser (); |
---|
25 | |
---|
26 | char* getVar(const char* name, char* section, char* defvalue); |
---|
27 | int openFile(const char* name); |
---|
28 | int getSection( char* section); |
---|
29 | int nextVar( char* name, char* value); |
---|
30 | |
---|
31 | private: |
---|
32 | FILE* stream; //!< A FileStream to be loaded |
---|
33 | bool bInSection; //!< if the requested parameter is in the section. |
---|
34 | char internbuf[PARSELINELENGHT]; //!< a buffer |
---|
35 | |
---|
36 | |
---|
37 | }; |
---|
38 | |
---|
39 | #endif /* _INI_PARSER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.