source: trunk/bin/Parameter.h @ 909

Last change on this file since 909 was 847, checked in by Peter Johansson, 14 years ago

updating copyrights

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1#ifndef _theplu_svndigest_parameter_
2#define _theplu_svndigest_parameter_
3
4// $Id: Parameter.h 847 2009-11-17 01:38:52Z peter $
5
6/*
7  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009 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 "OptionVersion.h"
27
28#include "yat/CommandLine.h"
29#include "yat/OptionArg.h"
30#include "yat/OptionHelp.h"
31#include "yat/OptionSwitch.h"
32
33
34#include <string>
35
36namespace theplu {
37namespace yat { 
38namespace utility {
39  class OptionHelp;
40  class OptionSwitch;
41}}
42namespace svndigest {
43
44  class OptionVersion;
45
46  // class for command line options.
47  class Parameter {
48  public:
49    Parameter( int argc, char *argv[]);
50    virtual ~Parameter(void);
51    std::string config_file(void) const;
52   
53    bool copyright(void) const;
54    bool force(void) const;
55    bool generate_config(void) const ;
56    bool ignore_cache(void) const;
57    bool report(void) const;
58    bool revisions(void) const;
59    /// @return absolute path to root directory
60    std::string root(void) const;
61    /// @return absolute path to target directory
62    std::string targetdir(void) const;
63    bool verbose(void) const;
64
65  private:
66    void analyse(void);
67    // throw cmd_error if path doesn't exist
68    void check_existence(std::string path) const;
69    // throw cmd_error if path is not dir
70    void check_is_dir(std::string path) const;
71    // throw cmd_error if path is not readable
72    void check_readable(std::string path) const;
73
74    void init(void);
75
76    yat::utility::CommandLine cmd_;
77    yat::utility::OptionArg<std::string> config_file_;
78    yat::utility::OptionSwitch copyright_;
79    yat::utility::OptionSwitch force_;
80    yat::utility::OptionSwitch generate_config_;
81    yat::utility::OptionHelp help_;
82    yat::utility::OptionSwitch ignore_cache_;
83    yat::utility::OptionSwitch report_;
84    yat::utility::OptionSwitch revisions_;
85    yat::utility::OptionArg<std::string> root_;
86    yat::utility::OptionArg<std::string> target_;
87    yat::utility::OptionSwitch verbose_;
88    OptionVersion version_;
89
90  };
91
92}} // of namespace svndigest and namespace theplu
93
94#endif
Note: See TracBrowser for help on using the repository browser.