1 | #ifndef _theplu_svndigest_copyright_stats_ |
---|
2 | #define _theplu_svndigest_copyright_stats_ |
---|
3 | |
---|
4 | // $Id: CopyrightStats.h 1358 2011-05-31 23:38:22Z peter $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2011 Peter Johansson |
---|
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 "Alias.h" |
---|
26 | |
---|
27 | #include <subversion-1/svn_types.h> |
---|
28 | |
---|
29 | #include <map> |
---|
30 | #include <set> |
---|
31 | #include <string> |
---|
32 | |
---|
33 | namespace theplu{ |
---|
34 | namespace svndigest{ |
---|
35 | |
---|
36 | /** |
---|
37 | */ |
---|
38 | class CopyrightStats |
---|
39 | { |
---|
40 | public: |
---|
41 | /** |
---|
42 | Constructor |
---|
43 | */ |
---|
44 | CopyrightStats(const std::string& path, bool ignore_cache, |
---|
45 | std::map<std::string, Alias>& author2alias, |
---|
46 | const std::map<int, svn_revnum_t>& year2rev); |
---|
47 | |
---|
48 | const std::map<int, std::set<Alias> > map(void) const; |
---|
49 | private: |
---|
50 | /** |
---|
51 | load data from cache file (if it exists), and then parse from |
---|
52 | blame remaining data required to build data. |
---|
53 | */ |
---|
54 | void init(bool ignore_cache, const std::map<int, svn_revnum_t>& year2rev); |
---|
55 | |
---|
56 | /// return 0 if load failed; otherwise return rev cache represents |
---|
57 | svn_revnum_t load_cache(const std::string& filename); |
---|
58 | |
---|
59 | void parse(svn_revnum_t rev, const std::map<int, svn_revnum_t>& year2rev); |
---|
60 | void reset(void); |
---|
61 | void write_cache(const std::string& filename); |
---|
62 | |
---|
63 | std::map<std::string, Alias>& author2alias_; |
---|
64 | std::string path_; |
---|
65 | std::map<int, std::set<Alias> > year2alias_; |
---|
66 | }; |
---|
67 | }} // end of namespace svndigest and namespace theplu |
---|
68 | |
---|
69 | #endif |
---|