source: trunk/lib/Node.h @ 74

Last change on this file since 74 was 74, checked in by Jari Häkkinen, 16 years ago

Improved web presentation. Y axises normalized, ticket ticket:15 resolved.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1// $Id: Node.h 74 2006-03-07 15:46:59Z jari $
2
3#ifndef _theplu_svnstat_node_
4#define _theplu_svnstat_node_
5
6#include "Stats.h"
7
8#include <ostream>
9#include <sstream>
10#include <string>
11
12namespace theplu{
13namespace svnstat{
14
15  ///
16  /// Abstract Base Class for files.
17  ///
18  class Node
19  {
20  public:
21    ///
22    /// @brief Constructor
23    ///
24    Node(const std::string& path, const std::string& output="");
25
26    ///
27    /// @brief Destructor
28    ///
29    virtual inline ~Node(void) {};
30
31    ///
32    /// @return A properly formatted html link to this node.
33    ///
34    inline std::string html_link(void) const
35    { return "<a href=\"" + output_name() + ".html\">" + name() + "</a>"; }
36
37    inline std::string html_tablerow(void) const
38    {
39      std::stringstream ss;
40      ss << "<tr><td>" << html_link() << "</td><td align=right>" << stats_.rows()
41         << "</td></tr>\n";
42      return ss.str();
43    }
44
45    inline const std::string& output_name(void) const { return output_name_; }
46
47    ///
48    /// @brief parsing file using svn blame.
49    ///
50    virtual const Stats& parse(const bool verbose=false)=0;
51
52    ///
53    /// Function printing HTML in current working directory
54    ///
55    virtual void print(const bool verbose=false) const=0;
56
57    ///
58    ///
59    ///
60    inline virtual void purge(const bool verbose=false) 
61    { /* Nothing to be done */ };
62
63    ///
64    /// Check if the node is under subversion control. This is done by
65    /// checking the return status of 'svn proplist <Node>.
66    ///
67    /// @return True if subversion controlled, false otherwise.
68    ///
69    bool subversion_controlled(void) const;
70
71  protected:
72    ///
73    /// Function returning everything after the last '/'
74    ///
75    /// @return name of node (not full path)
76    ///
77    std::string name(void) const;
78
79    ///
80    /// @brief print html footer of page
81    ///
82    void print_footer(std::ostream&) const;
83   
84    ///
85    /// @brief print html header of page
86    ///
87    void print_header(std::ostream&) const;
88
89    std::string output_name_; //without suffix
90    std::string path_;
91    Stats stats_;
92
93  private:
94    ///
95    /// @brief Copy Constructor, not implemented
96    ///
97    Node(const Node&);
98
99  };
100
101}} // end of namespace svnstat and namespace theplu
102
103#endif
Note: See TracBrowser for help on using the repository browser.