Changeset 258


Ignore:
Timestamp:
Apr 30, 2007, 2:08:25 PM (14 years ago)
Author:
Peter Johansson
Message:

moving some printing code to base class

Location:
trunk/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r244 r258  
    2828#include "Node.h"
    2929#include "SVN.h"
     30#include "SVNlog.h"
    3031#include "utility.h"
    3132
     
    120121
    121122
    122   void Directory::print(const bool verbose) const
    123   {
    124     if (ignore())
    125       return;
    126     if (verbose)
    127       std::cout << "Printing output for " << path_ << std::endl;
    128     print("all", "total");
    129     print("all", "code");
    130     print("all", "comments");
    131     print("all", "empty");
    132 
    133     for (std::set<std::string>::const_iterator i = stats_.authors().begin();
    134          i!=stats_.authors().end(); ++i) {
    135       print(*i, "total");
    136       print(*i, "code");
    137       print(*i, "comments");
    138       print(*i, "empty");
    139     }
    140 
     123  void Directory::print_core(const bool verbose) const
     124  {
    141125    // print daughter nodes, i.e., this function is recursive
    142126    for (NodeConstIterator i=daughters_.begin(); i!=daughters_.end(); ++i)
     
    145129
    146130
    147   void Directory::print(const std::string& user,
    148                         const std::string& line_type) const
     131  void Directory::print_core(const std::string& user,
     132                             const std::string& line_type,
     133                             const SVNlog& log) const
    149134  {
    150135    std::string outdir = user+"/"+line_type+"/"+local_path_;
     
    223208    os << "</tr>\n";
    224209    os << "</table>\n";
    225     print_author_summary(os, line_type);
     210    print_author_summary(os, line_type, log);
    226211    os << "</p>\n";
    227212    print_footer(os);
  • trunk/lib/Directory.h

    r234 r258  
    7979    const Stats& parse(const bool verbose=false);
    8080
    81     void print(const bool verbose=false) const;
    82 
    8381    void print_copyright(std::map<std::string, std::string>&) const;
    8482
     
    8987    Directory(const Directory&);
    9088
    91     void print(const std::string& user, const std::string& line_type) const;
     89    void print_core(bool verbose=false) const;
     90
     91    void print_core(const std::string& user, const std::string& line_type,
     92                    const SVNlog&) const;
    9293
    9394
  • trunk/lib/File.cc

    r244 r258  
    6161
    6262
    63   void File::print(const std::string& user, const std::string& line_type) const
     63  void File::print_core(const std::string& user, const std::string& line_type,
     64                        const SVNlog& log) const
    6465  {
    6566    std::string outpath = user+"/"+line_type+"/"+local_path();
     
    7980    os << "' alt='[plot]' border=0>\n</p>";
    8081
    81     print_author_summary(os, line_type);
     82    print_author_summary(os, line_type, log);
    8283    os << "</p>\n";
    8384
     
    8788
    8889
    89   void File::print(const bool verbose) const
    90   {
    91     // no output page for binary files
    92     if (ignore())
    93       return;
    94     if (verbose)
    95       std::cout << "Printing output for " << path_ << std::endl;
    96     print("all", "total");
    97     print("all", "code");
    98     print("all", "comments");
    99     print("all", "empty");
    100 
    101     for (std::set<std::string>::const_iterator i = stats_.authors().begin();
    102          i!=stats_.authors().end(); ++i) {
    103       print(*i, "total");
    104       print(*i, "code");
    105       print(*i, "comments");
    106       print(*i, "empty");
    107     }
    108 
     90  void File::print_core(const bool verbose) const
     91  {
    10992  }
    11093
  • trunk/lib/File.h

    r234 r258  
    8787    File(const File&);
    8888
     89    void print_core(bool verbose=false) const;
     90
    8991    ///
    9092    /// print page for specific user (or all) and specific line_style
    9193    /// (or total).
    9294    ///
    93     void print(const std::string& user, const std::string& line_type) const;
     95    void print_core(const std::string& user, const std::string& line_type,
     96                    const SVNlog&) const;
    9497
    9598  };
  • trunk/lib/Node.cc

    r252 r258  
    2525#include "Node.h"
    2626#include "html_utility.h"
     27#include "SVNlog.h"
    2728#include "SVNproperty.h"
    2829#include "utility.h"
     
    121122
    122123
    123   void Node::print_author_summary(std::ostream& os, std::string line_type) const
     124  void Node::print(const bool verbose) const
     125  {
     126    if (ignore())
     127      return;
     128    if (verbose)
     129      std::cout << "Printing output for " << path_ << std::endl;
     130    SVNlog log(path_);
     131    print_core("all", "total", log);
     132    print_core("all", "code", log);
     133    print_core("all", "comments", log);
     134    print_core("all", "empty", log);
     135
     136    for (std::set<std::string>::const_iterator i = stats_.authors().begin();
     137         i!=stats_.authors().end(); ++i) {
     138      print_core(*i, "total", log);
     139      print_core(*i, "code", log);
     140      print_core(*i, "comments", log);
     141      print_core(*i, "empty", log);
     142    }
     143   
     144    print_core(verbose);
     145  }
     146
     147
     148  void Node::print_author_summary(std::ostream& os, std::string line_type,
     149                                  const SVNlog& log) const
    124150  {
    125151    os << "<table class=\"listings\">\n";
  • trunk/lib/Node.h

    r235 r258  
    140140    /// Function printing HTML in current working directory
    141141    ///
    142     virtual void print(const bool verbose=false) const=0;
    143 
    144     void print_author_summary(std::ostream&, std::string) const;
     142    void print(const bool verbose=false) const;
     143
     144    void print_author_summary(std::ostream&, std::string, const SVNlog&) const;
    145145
    146146    virtual void
     
    177177    ///
    178178    Node(const Node&);
     179
     180    virtual void print_core(bool verbose=false) const=0;
     181
     182    ///
     183    /// print page for specific user (or all) and specific line_style
     184    /// (or total).
     185    ///
     186    virtual void print_core(const std::string& user,
     187                            const std::string& line_type,
     188                            const SVNlog&) const=0;
    179189
    180190    bool binary_;
Note: See TracChangeset for help on using the changeset viewer.