source: trunk/lib/Configuration.h @ 264

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

turned Configuration class into a singleton

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1#ifndef _theplu_svndigest_configuration_
2#define _theplu_svndigest_configuration_
3
4// $Id: Configuration.h 264 2007-04-30 21:54:25Z 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
31namespace theplu{
32namespace svndigest{
33
34  class Configuration
35  {
36  public:
37    static Configuration* instance(void);
38
39    ///
40    /// @brief load deafult configuration
41    ///
42    void load(void);
43
44    ///
45    /// @brief load configuration from stream
46    ///
47    void load(std::istream&);
48
49    ///
50    /// @brief Aliases for Copyright
51    ///
52    inline const std::map<std::string, std::string>&
53    copyright_alias(void) const { return copyright_alias_; }
54
55  private:
56    ///
57    /// Creates a Config object with default settings.
58    ///
59    /// @brief Default Constructor
60    ///
61    Configuration(void);
62
63    void clear(void);
64
65    void set_default(void);
66
67    static Configuration* instance_;
68
69    std::map<std::string, std::string> copyright_alias_;
70
71  };
72
73  ///
74  /// @brief Output operator
75  ///
76  std::ostream& operator<<(std::ostream&, const Configuration&);
77
78}} // end of namespace svndigest and namespace theplu
79
80#endif
81
82
Note: See TracBrowser for help on using the repository browser.