1 | #ifndef _theplu_svndigest_parameter_ |
---|
2 | #define _theplu_svndigest_parameter_ |
---|
3 | |
---|
4 | // $Id: Parameter.h 784 2009-04-09 20:18:54Z jari $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
---|
8 | Copyright (C) 2007, 2008 Peter Johansson |
---|
9 | |
---|
10 | This file is part of svndigest, http://dev.thep.lu.se/svndigest |
---|
11 | |
---|
12 | svndigest is free software; you can redistribute it and/or modify it |
---|
13 | under the terms of the GNU General Public License as published by |
---|
14 | the Free Software Foundation; either version 3 of the License, or |
---|
15 | (at your option) any later version. |
---|
16 | |
---|
17 | svndigest is distributed in the hope that it will be useful, but |
---|
18 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
20 | General Public License for more details. |
---|
21 | |
---|
22 | You should have received a copy of the GNU General Public License |
---|
23 | along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
---|
24 | */ |
---|
25 | |
---|
26 | #include "CommandLine.h" |
---|
27 | #include "OptionArg.h" |
---|
28 | |
---|
29 | #include <string> |
---|
30 | |
---|
31 | namespace theplu { |
---|
32 | namespace svndigest { |
---|
33 | |
---|
34 | class OptionHelp; |
---|
35 | class OptionSwitch; |
---|
36 | class OptionVersion; |
---|
37 | |
---|
38 | // class for command line options. |
---|
39 | class Parameter { |
---|
40 | public: |
---|
41 | Parameter( int argc, char *argv[]); |
---|
42 | virtual ~Parameter(void); |
---|
43 | std::string config_file(void) const; |
---|
44 | |
---|
45 | bool copyright(void) const; |
---|
46 | bool force(void) const; |
---|
47 | bool generate_config(void) const ; |
---|
48 | bool ignore_cache(void) const; |
---|
49 | bool report(void) const; |
---|
50 | bool revisions(void) const; |
---|
51 | /// @return absolute path to root directory |
---|
52 | std::string root(void) const; |
---|
53 | /// @return absolute path to target directory |
---|
54 | std::string targetdir(void) const; |
---|
55 | bool verbose(void) const; |
---|
56 | |
---|
57 | private: |
---|
58 | void analyse(void); |
---|
59 | // throw cmd_error if path doesn't exist |
---|
60 | void check_existence(std::string path) const; |
---|
61 | // throw cmd_error if path is not dir |
---|
62 | void check_is_dir(std::string path) const; |
---|
63 | // throw cmd_error if path is not readable |
---|
64 | void check_readable(std::string path) const; |
---|
65 | |
---|
66 | void init(void); |
---|
67 | |
---|
68 | CommandLine cmd_; |
---|
69 | OptionArg<std::string>* config_file_; |
---|
70 | OptionSwitch* copyright_; |
---|
71 | OptionSwitch* force_; |
---|
72 | OptionSwitch* generate_config_; |
---|
73 | OptionHelp* help_; |
---|
74 | OptionSwitch* ignore_cache_; |
---|
75 | OptionSwitch* report_; |
---|
76 | OptionSwitch* revisions_; |
---|
77 | OptionArg<std::string>* root_; |
---|
78 | OptionArg<std::string>* target_; |
---|
79 | OptionSwitch* verbose_; |
---|
80 | OptionVersion* version_; |
---|
81 | |
---|
82 | }; |
---|
83 | |
---|
84 | }} // of namespace svndigest and namespace theplu |
---|
85 | |
---|
86 | #endif |
---|