Last change
on this file since 3226 was
3224,
checked in by bensch, 20 years ago
|
orxonox/trunk: FILE_H → _FILE_H to all h-files.
|
File size:
785 bytes
|
Rev | Line | |
---|
[2064] | 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 | |
---|
[3224] | 8 | #ifndef _INI_PARSER_H |
---|
| 9 | #define _INI_PARSER_H |
---|
[2064] | 10 | |
---|
[2066] | 11 | #include <stdio.h> |
---|
[2167] | 12 | #include <string.h> |
---|
[2066] | 13 | #include <stdlib.h> |
---|
[2064] | 14 | |
---|
| 15 | #define PARSELINELENGHT 512 |
---|
| 16 | |
---|
[2141] | 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 | */ |
---|
[2064] | 21 | class IniParser { |
---|
| 22 | private: |
---|
| 23 | FILE* stream; |
---|
| 24 | bool bInSection; |
---|
[2065] | 25 | char internbuf[PARSELINELENGHT]; |
---|
[2064] | 26 | |
---|
| 27 | public: |
---|
| 28 | IniParser (char* filename); |
---|
| 29 | ~IniParser (); |
---|
| 30 | |
---|
[2066] | 31 | char* get_var( char* name, char* section, char* defvalue); |
---|
| 32 | int open_file( char* name); |
---|
| 33 | int get_section( char* section); |
---|
| 34 | int next_var( char* name, char* value); |
---|
[2064] | 35 | }; |
---|
| 36 | |
---|
[3224] | 37 | #endif /* _INI_PARSER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.