source: trunk/lib/NodePrinter.h @ 1290

Last change on this file since 1290 was 1290, checked in by Peter Johansson, 11 years ago

closes #457. Lifting out plotting functions in Stats into a new class
StatsPlotter?. In same manner lifting out print functions from
Node/Directory/File? into a new hierarchy
NodePrinter/DirectoryPrinter/FilePrinter?. To accomplish these splits
without to much recoding some friendships are introduced. These new
classes are only needed for svndigest (not svncopyright) and are
therefore placed in a library named libsvndigest together with Graph
class and first_page functions. Remaining functionality, shared
between svncopyright and svndigest, are located in libsvndigest_core
and linked into both binaries.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1#ifndef _theplu_svndigest_node_printer_
2#define _theplu_svndigest_node_printer_
3
4// $Id: NodePrinter.h 1290 2010-11-12 04:01:35Z peter $
5
6/*
7  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009 Peter Johansson
9  Copyright (C) 2010 Jari Häkkinen, Peter Johansson
10
11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
12
13  svndigest is free software; you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 3 of the License, or
16  (at your option) any later version.
17
18  svndigest is distributed in the hope that it will be useful, but
19  WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#include "html_utility.h"
28#include "LineTypeParser.h"
29#include "StatsCollection.h"
30#include "SVNinfo.h"
31#include "SVNlog.h"
32#include "TinyStats.h"
33#include "utility.h"
34
35#include <map>
36#include <ostream>
37#include <stdexcept>
38#include <string>
39
40namespace theplu{
41namespace svndigest{
42
43  class Node;
44
45  ///
46  /// Base class for FilePrinter and DirectoryPrinter
47  ///
48  class NodePrinter
49  {
50  public:
51
52    ///
53    /// @brief Constructor
54    ///
55    NodePrinter(void);
56
57    ///
58    /// @brief Destructor
59    ///
60    virtual ~NodePrinter(void);
61
62    /**
63       Note that returned string always end with '/' with the
64       exception when an empty string is returned.
65
66       @return output dir for example 'lib/' for this file
67     */
68    std::string output_dir(void) const;
69
70    /**
71       @return output path for example 'lib/NodePrinter.h.html' for this file
72     */
73    virtual std::string output_path(void) const=0;
74
75    ///
76    /// Function printing HTML in current working directory
77    ///
78    void print(const bool verbose=false) const;
79
80    void print_author_summary(std::ostream&, 
81                              const Stats& stats, 
82                              const std::string& line_type, 
83                              const SVNlog&) const; 
84
85  protected:
86    ///
87    /// print path in html format (with anchors) to @a os
88    ///
89    void path_anchor(std::ostream& os) const; 
90
91  private:
92    ///
93    /// @brief Copy Constructor, not implemented
94    ///
95    NodePrinter(const NodePrinter&);
96
97    virtual const Node& node(void) const=0;
98
99    virtual void print_core(bool verbose=false) const=0;
100
101    ///
102    /// print page for specific user (or all) and specific line_style
103    /// (or total).
104    ///
105    virtual void print_core(const std::string& stats_type,
106                            const std::string& user, 
107                            const std::string& line_type,
108                            const SVNlog&) const=0; 
109
110  };
111
112
113
114
115}} // end of namespace svndigest and namespace theplu
116
117#endif
Note: See TracBrowser for help on using the repository browser.