source: trunk/lib/Colours.h @ 916

Last change on this file since 916 was 916, checked in by Jari Häkkinen, 12 years ago

Addresses #75. Added author colouring. Currently jari and peter gets non-black hard-coded colour.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#ifndef _theplu_svndigest_colours_
2#define _theplu_svndigest_colours_
3
4// $Id: Colours.h 916 2009-11-30 20:02:40Z jari $
5
6/*
7  Copyright (C) 2009 Jari Häkkinen
8
9  This file is part of svndigest, http://dev.thep.lu.se/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 3 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 svndigest. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <map>
26#include <string>
27#include <vector>
28
29namespace theplu {
30namespace svndigest {
31
32  class Colours
33  {
34  public:
35
36    void get_colour(const std::string& label, unsigned char& r,
37                    unsigned char& g, unsigned char& b) const;
38
39    static Colours& instance(void);
40
41  private:
42
43    Colours(void);
44
45    // Copy constructor not implemented
46    Colours(const Colours&);
47
48    // Assignment not implemented because assignment is always self-assignment
49    Colours& operator=(const Colours&);
50
51    // Destructor not implemented
52    ~Colours(void);
53
54    struct colour {
55      std::string label;
56      unsigned char r,g,b;
57    };
58
59    static Colours* instance_;
60    std::vector<colour> colour_map_;
61    std::map<std::string, std::vector<colour>::iterator> author_map_;
62  };
63
64}} // end of namespace svndigest and namespace theplu
65
66#endif
Note: See TracBrowser for help on using the repository browser.