ARC SDK
ArcConfigFile.h
1 #ifndef __ARC_CONFIG_FILE_H__
2 #define __ARC_CONFIG_FILE_H__
3 
4 #include <cstring>
5 #include <iostream>
6 #include <fstream>
7 #include <string>
8 
9 #include <arc/XMLNode.h>
10 #include <arc/Logger.h>
11 
12 namespace Arc {
13 
14 class ConfigFile: public std::ifstream {
15  public:
16 
18  ConfigFile(void) { };
19 
21  ConfigFile(const std::string &path) { open(path); };
22 
24  bool open(const std::string &path);
25 
27  bool close(void);
28 
31  std::string read_line();
32 
34  static std::string read_line(std::istream& stream);
35 
37  typedef enum {
38  file_XML,
39  file_INI,
40  file_unknown
41  } file_type;
42 
44  file_type detect(void);
45 
46 };
47 
48 } // namespace Arc
49 
50 #endif // __ARC_CONFIG_FILE_H__
51 
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
file_type
Recognizable configuration file types.
Definition: ArcConfigFile.h:37
ConfigFile(void)
Default constructor creates object not associated with file.
Definition: ArcConfigFile.h:18
bool close(void)
Closes configuration file.
file_type detect(void)
Detect type of currently associated configuration file.
ConfigFile(const std::string &path)
Constructor creates object associated with file located at path.
Definition: ArcConfigFile.h:21
Definition: ArcConfigFile.h:14
std::string read_line()
bool open(const std::string &path)
Open/assign configuration file located at path to this object.