Ignore:
Timestamp:
Nov 12, 2010, 5:01:35 AM (11 years ago)
Author:
Peter Johansson
Message:

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.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/lib/DirectoryPrinter.h

    r1289 r1290  
    1 #ifndef _theplu_svndigest_directory_
    2 #define _theplu_svndigest_directory_
     1#ifndef _theplu_svndigest_directory_printer_
     2#define _theplu_svndigest_directory_printer_
    33
    44// $Id$
     
    2424*/
    2525
    26 #include "Node.h"
     26#include "NodePrinter.h"
    2727
    2828#include <map>
     
    3333namespace svndigest{
    3434
    35   class NodeVisitor;
     35  class Directory;
     36  class Node;
    3637
    3738  ///
    3839  /// Class taking care of directories.
    3940  ///
    40   class Directory : public Node
     41  class DirectoryPrinter : public NodePrinter
    4142  {
    4243  public:
    43     ///
    44     /// @brief Constructor
    45     ///
    46     /// Recursively create a directory tree starting from \a path. All
    47     /// entries except explicit directories are treated as File nodes,
    48     /// i.e. symbolic links to directories are treated as File
    49     /// nodes. This will ensure that the directory structure is a tree
    50     /// and double counting of branches is avoided.
    51     ///
    52     /// @note Nodes named '.', '..', and '.svn' are ignored and not
    53     /// traversed.
    54     ///
    55     Directory(const unsigned int level, const std::string& path,
    56               const std::string& output="", const std::string& project="");
    57 
    58     ///
    59     /// @brief Destructor
    60     ///
    61     ~Directory(void);
     44    /**
     45       \brief Constructor
     46    */
     47    explicit DirectoryPrinter(const Directory&);
    6248
    6349    /**
    64        Collect stats from daughter nodes and reset stats in daughter
    65        nodes.
    66      */
    67     void collect_stats(void);
    68 
    69     ///
    70     /// @return true
    71     ///
    72     bool dir(void) const;
    73 
    74     ///
    75     /// @return directory-name/index.html
    76     ///
    77     std::string href(void) const;
    78 
    79     /**
    80        \brief Get the revision number of the latest commit.
    81 
    82        Does not only check this directory but also daughter nodes.
     50       \brief Destructor
    8351    */
    84     svn_revnum_t last_changed_rev(void) const;
    85 
    86     /**
    87        @return The explicit string "directory", nothing else.
    88     */
    89     std::string node_type(void) const;
     52    ~DirectoryPrinter(void);
    9053
    9154    /**
     
    9457    std::string output_path(void) const;
    9558
    96     /**
    97        Calls visitor.enter(*this). If enter returns true, daughter
    98        nodes are traverses. Finally visitor visitor.leave(*this) i called.
    99      */
    100     void traverse(NodeVisitor& visitor);
    101 
    10259  private:
    103     /**
    104        add union of logs from daughter nodes.
    105     */
    106     void log_core(SVNlog&) const;
    107 
    10860    ///
    10961    /// @brief Copy Constructor, not implemented
    11062    ///
    111     Directory(const Directory&);
     63    DirectoryPrinter(const DirectoryPrinter&);
     64
     65    const Node& node(void) const;
    11266
    11367    void print_core(bool verbose=false) const;
     
    11771
    11872
     73   
     74
     75    const Directory& directory_;
    11976    typedef std::vector<Node*> NodeContainer;
    12077    typedef NodeContainer::iterator NodeIterator;
    12178    typedef NodeContainer::const_iterator NodeConstIterator;
    122     NodeContainer daughters_;
    12379  };
    12480
Note: See TracChangeset for help on using the changeset viewer.