source: trunk/bin/Parameter.h @ 696

Last change on this file since 696 was 693, checked in by Jari Häkkinen, 13 years ago

Fixes #339. Change to GPLv3.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1#ifndef _theplu_svndigest_parameter_
2#define _theplu_svndigest_parameter_
3
4// $Id: Parameter.h 693 2008-09-11 20:42:56Z jari $
5
6/*
7  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2007 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 "Option.h"
27
28#include <map>
29#include <string>
30
31namespace theplu {
32namespace svndigest {
33
34  // class for command line options.
35  class Parameter {
36  public:
37    Parameter( int argc, char *argv[]);
38    std::string config_file(void) const;
39    inline bool copyright(void) const { return copyright_.value(); }
40    /// @todo
41    inline bool force(void) const { return force_.value(); }
42    inline bool generate_config(void) const { return generate_config_.value(); }
43    inline bool ignore_cache(void) const { return ignore_cache_.value(); }
44    inline bool report(void) const { return report_.value(); }
45    inline bool revisions(void) const { return revisions_.value(); }
46    /// @return absolute path to root directory
47    inline const std::string& root(void) const { return root_.value(); }
48    /// @return absolute path to root node
49    inline const std::string& root_node(void) const {return root_node_.value();}
50    /// @return absolute path to target directory
51    inline const std::string& targetdir(void) const 
52    { return targetdir_.value(); }
53    inline bool verbose(void) const { return verbose_.value(); }
54
55  private:
56    void analyse(void);
57    void help(void) const;
58    void missing_argument(std::string opt) const;
59    void version(bool=false) const;
60
61    Option<std::string> config_file_;
62    Option<bool> copyright_;
63    Option<bool> force_;
64    Option<bool> generate_config_;
65    Option<bool> ignore_cache_;
66    Option<bool> report_;
67    Option<bool> revisions_;
68    Option<std::string> root_;
69    Option<std::string> root_node_;
70    Option<std::string> targetdir_;
71    Option<bool> verbose_;
72  };
73
74}} // of namespace svndigest and namespace theplu
75
76#endif
Note: See TracBrowser for help on using the repository browser.