source: trunk/lib/File.h @ 757

Last change on this file since 757 was 757, checked in by Peter Johansson, 13 years ago

closes #185 and avoid copying in recursive log function

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.5 KB
RevLine 
[165]1#ifndef _theplu_svndigest_file_
2#define _theplu_svndigest_file_
3
[7]4// $Id: File.h 757 2009-01-27 23:00:58Z peter $
[4]5
[84]6/*
[380]7  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson
[750]8  Copyright (C) 2009 Peter Johansson
[84]9
[687]10  This file is part of svndigest, http://dev.thep.lu.se/svndigest
[84]11
[149]12  svndigest is free software; you can redistribute it and/or modify it
[84]13  under the terms of the GNU General Public License as published by
[693]14  the Free Software Foundation; either version 3 of the License, or
[84]15  (at your option) any later version.
16
[149]17  svndigest is distributed in the hope that it will be useful, but
[84]18  WITHOUT ANY WARRANTY; without even the implied warranty of
[149]19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[84]20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
[693]23  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
[84]24*/
25
[4]26#include "Node.h"
27
[226]28#include <map>
[4]29#include <string>
30
31namespace theplu{
[149]32namespace svndigest{
[4]33
[129]34  class File : public Node
35  {
36  public:
37    ///
38    /// @brief Default Constructor
39    ///
[589]40    File(const unsigned int level, const std::string& path, 
[307]41         const std::string& output=""); 
[9]42
[330]43    /**
44       For example 'File.h.html'
45
46       @return href to this file
47    */
[175]48    std::string href(void) const;
[100]49
[380]50    /**
51       @return The explicit string "file", nothing else.
52    */
[343]53    std::string node_type(void) const;
[182]54
[343]55    /**
56       @return output path for example 'lib/File.h.html' for this file
57     */
58    std::string output_path(void) const;
59
[182]60    ///
[129]61    /// @brief Parsing out information from svn repository
[112]62    ///
[330]63    /// @return Stats object of the file
[112]64    ///
[538]65    const StatsCollection& parse(bool verbose, bool ignore);
[112]66
[653]67    using Node::print_copyright;
[462]68    /**
69       @throw std::runtime_error when a file error is encountered
70       updating the copyrights.
71    */
[653]72    void print_copyright(std::map<std::string, Alias>&, bool verbose,
73                         const std::map<int, svn_revnum_t>&) const;
[226]74
[129]75  private:
[750]76    std::string blame_output_file_name(void) const;
77
[452]78    /**
[757]79       do nothing
[452]80    */
[757]81    void log_core(SVNlog&) const;
[452]82
[425]83    ///
84    /// @brief Copy Constructor, not implemented
85    ///
86    File(const File&);
[176]87
88    ///
[129]89    /// @brief Parsing svn blame output
90    ///
91    /// @return true if parsing is succesful
92    ///
93    bool blame(void) const;
94
[425]95    /**
96       \return copyright block
97     */
98    std::string copyright_block(const std::map<int, std::set<Alias> >& map,
99                                const std::string& prefix) const;
[23]100
[380]101    /**
[425]102       Create a map from year to set of authors.
103     */
104    std::map<int, std::set<Alias> > 
[654]105    copyright_map(std::map<std::string, Alias>& alias,
106                  const std::map<int, svn_revnum_t>&) const;
[425]107
108    /**
109       Create a map from year to set of authors.
110
111       \return true if Copyright block is found
112     */
113    bool detect_copyright(std::string& block, size_t& start_at_line,
114                          size_t& end_at_line, std::string& prefix) const;
115
116    /**
[395]117       @brief Print blame output
[380]118    */
[398]119    void print_blame(std::ofstream& os) const;
[380]120
[258]121    void print_core(bool verbose=false) const;
122
[207]123    ///
124    /// print page for specific user (or all) and specific line_style
125    /// (or total).
126    ///
[497]127    void print_core(const std::string& stats_type, const std::string& user, 
128                    const std::string& line_type, const SVNlog&) const; 
[207]129
[425]130    /**
131       Doing the actual print of copyright statement
132
[426]133       \param block new copyright block
[425]134       \param start_at_line line number of first line in old block
135       \param end_at_line line number of first line after old block
136     */
137    void update_copyright(const std::string& block,
138                          size_t start_at_line, size_t end_at_line) const;
[129]139  };
[4]140
[149]141}} // end of namespace svndigest and namespace theplu
[4]142
[7]143#endif
[4]144
[7]145
Note: See TracBrowser for help on using the repository browser.