blob: 5d721ae4861944cf71fd2e9948e32123735f3f96 (
plain)
1 ////////////////////////////////////////////////////////////////////////
2 // FILE: configuration.h
3 // AUTHOR: Johannes Winkelmann, jw@tks6.net
4 // COPYRIGHT: (c) 2002 by Johannes Winkelmann
5 // ---------------------------------------------------------------------
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 ////////////////////////////////////////////////////////////////////////
11
12 #ifndef _CONFIGURATION_H_
13 #define _CONFIGURATION_H_
14
15 #include <string>
16 #include <list>
17 #include <utility>
18
19 class ArgParser;
20
21 /*!
22 Configuration file class
23 */
24 class Configuration
25 {
26 public:
27 Configuration( const std::string& configFile, const ArgParser* parser );
28 bool parse();
29
30 bool writeLog() const;
31 bool appendLog() const;
32 bool removeLogOnSuccess() const;
33 std::string logFilePattern() const;
34
35 const std::list< std::pair<std::string, std::string> >& rootList() const;
36
37
38 enum ReadmeMode { VERBOSE_README, COMPACT_README, NO_README };
39 ReadmeMode readmeMode() const;
40
41 std::string cacheFile() const;
42
43 bool runScripts() const;
44 bool preferHigher() const;
45 bool useRegex() const;
46
47 void addConfig(const std::string& line,
48 bool configSet,
49 bool configPrepend);
50
51 std::string makeCommand() const;
52 std::string addCommand() const;
53 std::string removeCommand() const;
54 std::string runscriptCommand() const;
55
56 private:
57 std::string m_configFile;
58 const ArgParser* m_parser;
59
60 // config data
61 std::string m_cacheFile;
62
63 std::list< std::pair<std::string, std::string> > m_rootList;
64
65 std::string m_logFilePattern;
66 bool m_writeLog;
67 bool m_appendLog;
68 bool m_removeLogOnSuccess;
69
70 ReadmeMode m_readmeMode;
71
72 bool m_runScripts;
73 bool m_preferHigher;
74 bool m_useRegex;
75
76 std::string m_makeCommand;
77 std::string m_addCommand;
78 std::string m_removeCommand;
79 std::string m_runscriptCommand;
80
81
82 void parseLine(const std::string& line, bool prepend=false);
83 };
84
85 #endif /* _CONFIGURATION_H_ */
|