532 |
26 Dec 07 |
peter |
1 |
#ifndef _theplu_svndigest_stats_collection_ |
532 |
26 Dec 07 |
peter |
2 |
#define _theplu_svndigest_stats_collection_ |
532 |
26 Dec 07 |
peter |
3 |
|
532 |
26 Dec 07 |
peter |
// $Id$ |
532 |
26 Dec 07 |
peter |
5 |
|
532 |
26 Dec 07 |
peter |
6 |
/* |
532 |
26 Dec 07 |
peter |
Copyright (C) 2007 Peter Johansson |
978 |
12 Dec 09 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
1478 |
29 May 12 |
peter |
Copyright (C) 2010, 2012 Peter Johansson |
532 |
26 Dec 07 |
peter |
10 |
|
687 |
04 Aug 08 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
532 |
26 Dec 07 |
peter |
12 |
|
532 |
26 Dec 07 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
532 |
26 Dec 07 |
peter |
under the terms of the GNU General Public License as published by |
693 |
11 Sep 08 |
jari |
the Free Software Foundation; either version 3 of the License, or |
532 |
26 Dec 07 |
peter |
(at your option) any later version. |
532 |
26 Dec 07 |
peter |
17 |
|
532 |
26 Dec 07 |
peter |
svndigest is distributed in the hope that it will be useful, but |
532 |
26 Dec 07 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
532 |
26 Dec 07 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
532 |
26 Dec 07 |
peter |
General Public License for more details. |
532 |
26 Dec 07 |
peter |
22 |
|
532 |
26 Dec 07 |
peter |
You should have received a copy of the GNU General Public License |
693 |
11 Sep 08 |
jari |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
532 |
26 Dec 07 |
peter |
25 |
*/ |
532 |
26 Dec 07 |
peter |
26 |
|
532 |
26 Dec 07 |
peter |
27 |
#include "Stats.h" |
532 |
26 Dec 07 |
peter |
28 |
|
1478 |
29 May 12 |
peter |
29 |
#include <subversion-1/svn_types.h> |
1478 |
29 May 12 |
peter |
30 |
|
532 |
26 Dec 07 |
peter |
31 |
#include <map> |
532 |
26 Dec 07 |
peter |
32 |
#include <string> |
532 |
26 Dec 07 |
peter |
33 |
|
532 |
26 Dec 07 |
peter |
34 |
namespace theplu{ |
532 |
26 Dec 07 |
peter |
35 |
namespace svndigest{ |
532 |
26 Dec 07 |
peter |
36 |
|
532 |
26 Dec 07 |
peter |
37 |
/// |
532 |
26 Dec 07 |
peter |
/// Class taking care of statistics from svn. |
532 |
26 Dec 07 |
peter |
39 |
/// |
532 |
26 Dec 07 |
peter |
40 |
class StatsCollection |
532 |
26 Dec 07 |
peter |
41 |
{ |
532 |
26 Dec 07 |
peter |
42 |
public: |
1478 |
29 May 12 |
peter |
43 |
/// |
1478 |
29 May 12 |
peter |
/// @brief Default Constructor |
532 |
26 Dec 07 |
peter |
45 |
/// |
532 |
26 Dec 07 |
peter |
46 |
explicit StatsCollection(const std::string& path); |
532 |
26 Dec 07 |
peter |
47 |
|
532 |
26 Dec 07 |
peter |
48 |
/** |
532 |
26 Dec 07 |
peter |
\brief Destructor |
532 |
26 Dec 07 |
peter |
50 |
*/ |
532 |
26 Dec 07 |
peter |
51 |
virtual ~StatsCollection(void); |
532 |
26 Dec 07 |
peter |
52 |
|
532 |
26 Dec 07 |
peter |
53 |
/** |
532 |
26 Dec 07 |
peter |
\return true if cache was up to date |
532 |
26 Dec 07 |
peter |
55 |
*/ |
532 |
26 Dec 07 |
peter |
56 |
bool load_cache(std::istream&); |
532 |
26 Dec 07 |
peter |
57 |
|
538 |
27 Dec 07 |
peter |
58 |
/** |
538 |
27 Dec 07 |
peter |
Do the parsing for different statistics |
538 |
27 Dec 07 |
peter |
60 |
*/ |
538 |
27 Dec 07 |
peter |
61 |
void parse(const std::string& path); |
532 |
26 Dec 07 |
peter |
62 |
|
532 |
26 Dec 07 |
peter |
63 |
/** |
532 |
26 Dec 07 |
peter |
64 |
*/ |
532 |
26 Dec 07 |
peter |
65 |
void print(std::ostream&); |
532 |
26 Dec 07 |
peter |
66 |
|
532 |
26 Dec 07 |
peter |
67 |
/** |
532 |
26 Dec 07 |
peter |
reset everything |
532 |
26 Dec 07 |
peter |
69 |
*/ |
532 |
26 Dec 07 |
peter |
70 |
void reset(void); |
532 |
26 Dec 07 |
peter |
71 |
|
1478 |
29 May 12 |
peter |
72 |
/** |
1478 |
29 May 12 |
peter |
73 |
*/ |
1478 |
29 May 12 |
peter |
74 |
void ignore_rev(svn_revnum_t rev); |
1478 |
29 May 12 |
peter |
75 |
|
538 |
27 Dec 07 |
peter |
76 |
const std::map<std::string, Stats*>& stats(void) const; |
538 |
27 Dec 07 |
peter |
77 |
|
532 |
26 Dec 07 |
peter |
78 |
/** |
532 |
26 Dec 07 |
peter |
79 |
*/ |
532 |
26 Dec 07 |
peter |
80 |
const StatsCollection& operator+=(const StatsCollection&); |
532 |
26 Dec 07 |
peter |
81 |
|
532 |
26 Dec 07 |
peter |
82 |
/** |
532 |
26 Dec 07 |
peter |
\return const Stats reference associated to \a key |
532 |
26 Dec 07 |
peter |
84 |
|
532 |
26 Dec 07 |
peter |
\throw if key does not exists |
532 |
26 Dec 07 |
peter |
86 |
*/ |
532 |
26 Dec 07 |
peter |
87 |
const Stats& operator[](const std::string& key) const; |
532 |
26 Dec 07 |
peter |
88 |
|
532 |
26 Dec 07 |
peter |
89 |
/** |
532 |
26 Dec 07 |
peter |
\return Stats reference associated to \a key |
532 |
26 Dec 07 |
peter |
91 |
*/ |
532 |
26 Dec 07 |
peter |
92 |
Stats& operator[](const std::string& key); |
532 |
26 Dec 07 |
peter |
93 |
|
532 |
26 Dec 07 |
peter |
94 |
private: |
1081 |
08 Jun 10 |
peter |
// copy not allowed |
1081 |
08 Jun 10 |
peter |
96 |
StatsCollection(const StatsCollection&); |
1081 |
08 Jun 10 |
peter |
97 |
StatsCollection& operator=(const StatsCollection&); |
1081 |
08 Jun 10 |
peter |
98 |
|
532 |
26 Dec 07 |
peter |
99 |
const std::string path_; |
532 |
26 Dec 07 |
peter |
100 |
typedef std::map<std::string, Stats*> map; |
532 |
26 Dec 07 |
peter |
101 |
map stats_; |
532 |
26 Dec 07 |
peter |
102 |
}; |
532 |
26 Dec 07 |
peter |
103 |
}} // end of namespace svndigest end of namespace theplu |
532 |
26 Dec 07 |
peter |
104 |
|
1478 |
29 May 12 |
peter |
105 |
#endif |