source: trunk/lib/Configuration.h @ 274

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

support for Trac. Fixes #125. Also added a config file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1#ifndef _theplu_svndigest_configuration_
2#define _theplu_svndigest_configuration_
3
4// $Id: Configuration.h 274 2007-05-02 09:05:55Z peter $
5
6/*
7  Copyright (C) 2007 Peter Johansson
8
9  This file is part of svndigest, http://lev.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 <iostream>
28#include <map>
29#include <string>
30#include <utility>
31
32namespace theplu{
33namespace svndigest{
34
35  ///
36  /// Configuration class takes care of all setting defined in the
37  /// configuration file.
38  ///
39  class Configuration
40  {
41  public:
42    static Configuration* instance(void);
43
44    ///
45    /// @brief load deafult configuration
46    ///
47    void load(void);
48
49    ///
50    /// @brief load configuration from stream
51    ///
52    void load(std::istream&);
53
54    ///
55    /// @brief Aliases for Copyright
56    ///
57    inline const std::map<std::string, std::string>&
58    copyright_alias(void) const { return copyright_alias_; }
59
60    ///
61    /// @return root for the trac envrionment, e.g.,
62    /// http://lev.thep.lu.se/trac/svndigest/ticket/
63    ///
64    inline std::string trac_ticket(void) const { return trac_ticket_; }
65
66    ///
67    /// @return root for the trac envrionment, e.g.,
68    /// http://lev.thep.lu.se/trac/svndigest/ticket/
69    ///
70    std::string trac_revision(void) const { return trac_revision_; }
71
72  private:
73    ///
74    /// Creates a Config object with default settings.
75    ///
76    /// @brief Default Constructor
77    ///
78    Configuration(void);
79    // Copy Constructor not implemented
80    Configuration(const Configuration&);
81
82    void clear(void);
83
84    void set_default(void);
85
86    static Configuration* instance_;
87
88    std::map<std::string, std::string> copyright_alias_;
89
90    std::string trac_ticket_;
91    std::string trac_revision_;
92   
93  };
94
95  ///
96  /// @brief Output operator
97  ///
98  std::ostream& operator<<(std::ostream&, const Configuration&);
99
100}} // end of namespace svndigest and namespace theplu
101
102#endif
103
104
Note: See TracBrowser for help on using the repository browser.