1 | // $Id: Node.h 29 2006-01-09 09:35:50Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_svnstat_node_ |
---|
4 | #define _theplu_svnstat_node_ |
---|
5 | |
---|
6 | #include "Stats.h" |
---|
7 | |
---|
8 | #include <ostream> |
---|
9 | #include <string> |
---|
10 | |
---|
11 | namespace theplu{ |
---|
12 | namespace svnstat{ |
---|
13 | |
---|
14 | /// |
---|
15 | /// Abstract Base Class for files. |
---|
16 | /// |
---|
17 | class Node |
---|
18 | { |
---|
19 | public: |
---|
20 | /// |
---|
21 | /// @brief Constructor |
---|
22 | /// |
---|
23 | Node(const std::string& path, const std::string& output=""); |
---|
24 | |
---|
25 | /// |
---|
26 | /// @brief Destructor |
---|
27 | /// |
---|
28 | virtual inline ~Node(void) {}; |
---|
29 | |
---|
30 | /// |
---|
31 | /// @brief parsing file using svn blame. |
---|
32 | /// |
---|
33 | virtual const Stats& parse(void)=0; |
---|
34 | |
---|
35 | /// |
---|
36 | /// Function printing HTML in directory path |
---|
37 | /// |
---|
38 | virtual void print(const std::string& path) const=0; |
---|
39 | |
---|
40 | /// |
---|
41 | /// Prints a html link. |
---|
42 | /// |
---|
43 | inline void print_link(std::ostream& os) const |
---|
44 | { os << "<a href=\"" << output_name_ << ".html\">" << name() << "</a>"; } |
---|
45 | |
---|
46 | /// |
---|
47 | /// |
---|
48 | /// |
---|
49 | inline virtual void purge(void) { /* Nothing to be done */ }; |
---|
50 | |
---|
51 | /// |
---|
52 | /// Check if the node is under subversion control. This is done by |
---|
53 | /// checking the return status of 'svn proplist <Node>. |
---|
54 | /// |
---|
55 | /// @return True if subversion controlled, false otherwise. |
---|
56 | /// |
---|
57 | bool subversion_controlled(void) const; |
---|
58 | |
---|
59 | protected: |
---|
60 | /// |
---|
61 | /// Function returning everything after the last '/' |
---|
62 | /// |
---|
63 | /// @return name of node (not full path) |
---|
64 | /// |
---|
65 | std::string name(void) const; |
---|
66 | |
---|
67 | /// |
---|
68 | /// @brief print html footer of page |
---|
69 | /// |
---|
70 | void print_footer(std::ostream&) const; |
---|
71 | |
---|
72 | /// |
---|
73 | /// @brief print html header of page |
---|
74 | /// |
---|
75 | void print_header(std::ostream&) const; |
---|
76 | |
---|
77 | std::string output_name_; //without suffix |
---|
78 | std::string path_; |
---|
79 | Stats stats_; |
---|
80 | |
---|
81 | private: |
---|
82 | /// |
---|
83 | /// @brief Copy Constructor, not implemented |
---|
84 | /// |
---|
85 | Node(const Node&); |
---|
86 | |
---|
87 | }; |
---|
88 | |
---|
89 | }} // end of namespace svnstat and namespace theplu |
---|
90 | |
---|
91 | #endif |
---|