source: trunk/lib/Configuration.h @ 446

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

fixes #243

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#ifndef _theplu_svndigest_configuration_
2#define _theplu_svndigest_configuration_
3
4// $Id: Configuration.h 446 2007-08-16 15:57:18Z peter $
5
6/*
7  Copyright (C) 2007 Peter Johansson
8
9  This file is part of svndigest, http://trac.thep.lu.se/trac/svndigest
10
11  svndigest is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation; either version 2 of the License, or
14  (at your option) any later version.
15
16  svndigest is distributed in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include "Alias.h"
28
29#include <iostream>
30#include <map>
31#include <string>
32#include <utility>
33
34namespace theplu{
35namespace svndigest{
36
37  ///
38  /// Configuration class takes care of all setting defined in the
39  /// configuration file.
40  ///
41  class Configuration
42  {
43  public:
44    static Configuration& instance(void);
45
46    ///
47    /// @brief Aliases for Copyright
48    ///
49    const std::map<std::string, Alias>& copyright_alias(void) const;
50
51    ///
52    /// @brief load deafult configuration
53    ///
54    void load(void);
55
56    ///
57    /// throw if stream is not a valid config
58    ///
59    /// @brief load configuration from stream
60    ///
61    void load(std::istream&);
62
63    ///
64    /// @return true if we should warn about missing copyright statement
65    ///
66    bool  missing_copyright_warning(void) const;
67
68    ///
69    /// @return root for the trac envrionment, e.g.,
70    /// http://trac.thep.lu.se/trac/svndigest/
71    ///
72    std::string trac_root(void) const;
73
74  private:
75    ///
76    /// Creates a Config object with default settings.
77    ///
78    /// @brief Default Constructor
79    ///
80    Configuration(void);
81    // Copy Constructor not implemented
82    Configuration(const Configuration&);
83    // assignment not implemented because assignment is always self-assignment
84    Configuration& operator=(const Configuration&);
85
86    void clear(void);
87
88    bool equal_false(const std::string&) const;
89    bool equal_true(const std::string&) const;
90
91    void set_default(void);
92
93    static Configuration* instance_;
94
95    std::map<std::string, Alias> copyright_alias_;
96
97    bool missing_copyright_warning_;
98    std::string trac_root_;
99  };
100
101  ///
102  /// @brief Output operator
103  ///
104  std::ostream& operator<<(std::ostream&, const Configuration&);
105
106}} // end of namespace svndigest and namespace theplu
107
108#endif
109
110
Note: See TracBrowser for help on using the repository browser.