1 | // $Id: Node.h 13 2005-12-30 13:53:50Z jari $ |
---|
2 | |
---|
3 | #ifndef _theplu_svnstat_node_ |
---|
4 | #define _theplu_svnstat_node_ |
---|
5 | |
---|
6 | #include <map> |
---|
7 | #include <string> |
---|
8 | #include <vector> |
---|
9 | |
---|
10 | namespace theplu{ |
---|
11 | namespace svnstat{ |
---|
12 | |
---|
13 | /// |
---|
14 | /// Abstract Base Class for files. |
---|
15 | /// |
---|
16 | class Node |
---|
17 | { |
---|
18 | public: |
---|
19 | /// |
---|
20 | /// @brief Constructor |
---|
21 | /// |
---|
22 | inline Node(const std::string& path) : path_(path) { info(); } |
---|
23 | |
---|
24 | /// |
---|
25 | /// @brief Destructor |
---|
26 | /// |
---|
27 | virtual inline ~Node(void) {}; |
---|
28 | |
---|
29 | /// |
---|
30 | /// @return accumulated vector of total |
---|
31 | /// |
---|
32 | std::vector<u_int> accumulated(void) const; |
---|
33 | |
---|
34 | /// |
---|
35 | /// @return accumulated vector of stats_[user] |
---|
36 | /// |
---|
37 | std::vector<u_int> accumulated(const std::string& user); |
---|
38 | |
---|
39 | /// |
---|
40 | /// @brief adding a line to user from revision to the stats |
---|
41 | /// |
---|
42 | void add(const std::string& user, const u_int& revision); |
---|
43 | |
---|
44 | /// |
---|
45 | /// @brief parsing file using svn blame. |
---|
46 | /// |
---|
47 | virtual bool parse(void)=0; |
---|
48 | |
---|
49 | /// |
---|
50 | /// Function printing HTML in directory path |
---|
51 | /// |
---|
52 | virtual void print(void)=0; |
---|
53 | |
---|
54 | /// |
---|
55 | /// Check if the node is under subversion control. |
---|
56 | /// |
---|
57 | /// @return True if subversion controlled, false otherwise. |
---|
58 | /// |
---|
59 | bool subversion_controlled(void) const; |
---|
60 | |
---|
61 | protected: |
---|
62 | /// |
---|
63 | /// @brief performing svn info and parsing the info. |
---|
64 | /// |
---|
65 | /// @return true if parsing succesful |
---|
66 | /// |
---|
67 | bool info(void); |
---|
68 | |
---|
69 | std::string author_; |
---|
70 | std::string path_; |
---|
71 | u_int revision_; |
---|
72 | // Peter, if the vector is sparse make it a map |
---|
73 | std::map<std::string, std::vector<u_int> > stats_; |
---|
74 | std::string uuid_; |
---|
75 | |
---|
76 | private: |
---|
77 | /// |
---|
78 | /// @brief Copy Constructor, not implemented |
---|
79 | /// |
---|
80 | Node(const Node&); |
---|
81 | }; |
---|
82 | |
---|
83 | }} // end of namespace svnstat and namespace theplu |
---|
84 | |
---|
85 | #endif |
---|