1293 |
14 Nov 10 |
peter |
1 |
#ifndef _theplu_svndigest_abstract_parameter_ |
1293 |
14 Nov 10 |
peter |
2 |
#define _theplu_svndigest_abstract_parameter_ |
165 |
24 Aug 06 |
jari |
3 |
|
37 |
13 Jan 06 |
peter |
// $Id$ |
37 |
13 Jan 06 |
peter |
5 |
|
84 |
13 Mar 06 |
jari |
6 |
/* |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2007 Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
1635 |
30 Mar 23 |
peter |
Copyright (C) 2009, 2010 Peter Johansson |
84 |
13 Mar 06 |
jari |
11 |
|
687 |
04 Aug 08 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
84 |
13 Mar 06 |
jari |
13 |
|
149 |
12 Aug 06 |
jari |
svndigest is free software; you can redistribute it and/or modify it |
84 |
13 Mar 06 |
jari |
under the terms of the GNU General Public License as published by |
693 |
11 Sep 08 |
jari |
the Free Software Foundation; either version 3 of the License, or |
84 |
13 Mar 06 |
jari |
(at your option) any later version. |
84 |
13 Mar 06 |
jari |
18 |
|
149 |
12 Aug 06 |
jari |
svndigest is distributed in the hope that it will be useful, but |
84 |
13 Mar 06 |
jari |
WITHOUT ANY WARRANTY; without even the implied warranty of |
149 |
12 Aug 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
84 |
13 Mar 06 |
jari |
General Public License for more details. |
84 |
13 Mar 06 |
jari |
23 |
|
84 |
13 Mar 06 |
jari |
You should have received a copy of the GNU General Public License |
693 |
11 Sep 08 |
jari |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
84 |
13 Mar 06 |
jari |
26 |
*/ |
84 |
13 Mar 06 |
jari |
27 |
|
1119 |
04 Jul 10 |
peter |
28 |
#include "lib/OptionVersion.h" |
820 |
12 Sep 09 |
peter |
29 |
|
795 |
30 Jun 09 |
peter |
30 |
#include "yat/CommandLine.h" |
795 |
30 Jun 09 |
peter |
31 |
#include "yat/OptionArg.h" |
820 |
12 Sep 09 |
peter |
32 |
#include "yat/OptionHelp.h" |
820 |
12 Sep 09 |
peter |
33 |
#include "yat/OptionSwitch.h" |
625 |
23 Apr 08 |
peter |
34 |
|
820 |
12 Sep 09 |
peter |
35 |
|
37 |
13 Jan 06 |
peter |
36 |
#include <string> |
37 |
13 Jan 06 |
peter |
37 |
|
37 |
13 Jan 06 |
peter |
38 |
namespace theplu { |
1513 |
23 Sep 12 |
peter |
39 |
namespace yat { |
795 |
30 Jun 09 |
peter |
40 |
namespace utility { |
795 |
30 Jun 09 |
peter |
41 |
class OptionHelp; |
795 |
30 Jun 09 |
peter |
42 |
class OptionSwitch; |
795 |
30 Jun 09 |
peter |
43 |
}} |
149 |
12 Aug 06 |
jari |
44 |
namespace svndigest { |
37 |
13 Jan 06 |
peter |
45 |
|
705 |
25 Nov 08 |
peter |
46 |
class OptionVersion; |
705 |
25 Nov 08 |
peter |
47 |
|
37 |
13 Jan 06 |
peter |
// class for command line options. |
1293 |
14 Nov 10 |
peter |
49 |
class AbstractParameter { |
37 |
13 Jan 06 |
peter |
50 |
public: |
1293 |
14 Nov 10 |
peter |
51 |
AbstractParameter(void); |
1293 |
14 Nov 10 |
peter |
52 |
virtual ~AbstractParameter(void); |
1060 |
02 Jun 10 |
peter |
53 |
void parse( int argc, char *argv[]); |
1060 |
02 Jun 10 |
peter |
54 |
|
1264 |
02 Nov 10 |
peter |
55 |
/** |
1264 |
02 Nov 10 |
peter |
@return Dereferenced absolute path to root directory |
1264 |
02 Nov 10 |
peter |
57 |
*/ |
705 |
25 Nov 08 |
peter |
58 |
std::string root(void) const; |
1264 |
02 Nov 10 |
peter |
59 |
|
1264 |
02 Nov 10 |
peter |
60 |
/** |
1264 |
02 Nov 10 |
peter |
If --root argument is a link we return the file_name(argument). |
1264 |
02 Nov 10 |
peter |
Otherwise we return file_name(root()). See root(void). |
1264 |
02 Nov 10 |
peter |
63 |
|
1264 |
02 Nov 10 |
peter |
\return basename of --root argument. |
1264 |
02 Nov 10 |
peter |
65 |
*/ |
1264 |
02 Nov 10 |
peter |
66 |
const std::string& root_basename(void) const; |
705 |
25 Nov 08 |
peter |
67 |
bool verbose(void) const; |
37 |
13 Jan 06 |
peter |
68 |
|
1060 |
02 Jun 10 |
peter |
69 |
protected: |
1060 |
02 Jun 10 |
peter |
70 |
yat::utility::CommandLine cmd_; |
1060 |
02 Jun 10 |
peter |
71 |
yat::utility::OptionHelp help_; |
1293 |
14 Nov 10 |
peter |
72 |
yat::utility::OptionArg<std::string> root_; |
1060 |
02 Jun 10 |
peter |
73 |
|
1293 |
14 Nov 10 |
peter |
// check that root is OK, i.e., an existing, readable and |
1293 |
14 Nov 10 |
peter |
// accessible directory. throw cmd_error if not. |
1293 |
14 Nov 10 |
peter |
76 |
void analyse_root(const std::string root); |
1293 |
14 Nov 10 |
peter |
77 |
|
705 |
25 Nov 08 |
peter |
// throw cmd_error if path doesn't exist |
705 |
25 Nov 08 |
peter |
79 |
void check_existence(std::string path) const; |
705 |
25 Nov 08 |
peter |
// throw cmd_error if path is not dir |
705 |
25 Nov 08 |
peter |
81 |
void check_is_dir(std::string path) const; |
705 |
25 Nov 08 |
peter |
// throw cmd_error if path is not readable |
705 |
25 Nov 08 |
peter |
83 |
void check_readable(std::string path) const; |
37 |
13 Jan 06 |
peter |
84 |
|
1060 |
02 Jun 10 |
peter |
85 |
private: |
1060 |
02 Jun 10 |
peter |
86 |
void analyse(void); |
1293 |
14 Nov 10 |
peter |
87 |
virtual void analyse1(void)=0; |
705 |
25 Nov 08 |
peter |
88 |
void init(void); |
1060 |
02 Jun 10 |
peter |
// called at end of init(void) |
1293 |
14 Nov 10 |
peter |
90 |
virtual void init1(void) = 0; |
1060 |
02 Jun 10 |
peter |
91 |
void set_default(void); |
1293 |
14 Nov 10 |
peter |
92 |
virtual void set_default1(void)=0; |
705 |
25 Nov 08 |
peter |
93 |
|
1264 |
02 Nov 10 |
peter |
94 |
std::string root_basename_; |
1264 |
02 Nov 10 |
peter |
95 |
std::string root_full_; |
820 |
12 Sep 09 |
peter |
96 |
yat::utility::OptionSwitch verbose_; |
1060 |
02 Jun 10 |
peter |
97 |
protected: |
820 |
12 Sep 09 |
peter |
98 |
OptionVersion version_; |
705 |
25 Nov 08 |
peter |
99 |
|
37 |
13 Jan 06 |
peter |
100 |
}; |
37 |
13 Jan 06 |
peter |
101 |
|
149 |
12 Aug 06 |
jari |
102 |
}} // of namespace svndigest and namespace theplu |
37 |
13 Jan 06 |
peter |
103 |
|
37 |
13 Jan 06 |
peter |
104 |
#endif |