[7] | 1 | // $Id: Node.h 29 2006-01-09 09:35:50Z peter $ |
---|
[4] | 2 | |
---|
| 3 | #ifndef _theplu_svnstat_node_ |
---|
| 4 | #define _theplu_svnstat_node_ |
---|
| 5 | |
---|
[14] | 6 | #include "Stats.h" |
---|
| 7 | |
---|
[29] | 8 | #include <ostream> |
---|
[4] | 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 | /// |
---|
[29] | 23 | Node(const std::string& path, const std::string& output=""); |
---|
[4] | 24 | |
---|
[9] | 25 | /// |
---|
| 26 | /// @brief Destructor |
---|
| 27 | /// |
---|
| 28 | virtual inline ~Node(void) {}; |
---|
[4] | 29 | |
---|
| 30 | /// |
---|
| 31 | /// @brief parsing file using svn blame. |
---|
| 32 | /// |
---|
[14] | 33 | virtual const Stats& parse(void)=0; |
---|
[4] | 34 | |
---|
[10] | 35 | /// |
---|
| 36 | /// Function printing HTML in directory path |
---|
| 37 | /// |
---|
[23] | 38 | virtual void print(const std::string& path) const=0; |
---|
[4] | 39 | |
---|
[23] | 40 | /// |
---|
| 41 | /// Prints a html link. |
---|
| 42 | /// |
---|
[29] | 43 | inline void print_link(std::ostream& os) const |
---|
| 44 | { os << "<a href=\"" << output_name_ << ".html\">" << name() << "</a>"; } |
---|
| 45 | |
---|
[23] | 46 | /// |
---|
| 47 | /// |
---|
| 48 | /// |
---|
[18] | 49 | inline virtual void purge(void) { /* Nothing to be done */ }; |
---|
| 50 | |
---|
[13] | 51 | /// |
---|
[18] | 52 | /// Check if the node is under subversion control. This is done by |
---|
| 53 | /// checking the return status of 'svn proplist <Node>. |
---|
[13] | 54 | /// |
---|
| 55 | /// @return True if subversion controlled, false otherwise. |
---|
| 56 | /// |
---|
[18] | 57 | bool subversion_controlled(void) const; |
---|
[13] | 58 | |
---|
[4] | 59 | protected: |
---|
[23] | 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 | |
---|
[29] | 77 | std::string output_name_; //without suffix |
---|
[4] | 78 | std::string path_; |
---|
[14] | 79 | Stats stats_; |
---|
[4] | 80 | |
---|
[9] | 81 | private: |
---|
| 82 | /// |
---|
| 83 | /// @brief Copy Constructor, not implemented |
---|
| 84 | /// |
---|
| 85 | Node(const Node&); |
---|
[29] | 86 | |
---|
[9] | 87 | }; |
---|
[4] | 88 | |
---|
[7] | 89 | }} // end of namespace svnstat and namespace theplu |
---|
[4] | 90 | |
---|
[7] | 91 | #endif |
---|