source: trunk/lib/File.h @ 462

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

Merged patch release 0.6.2 to the trunk. Delta 0.6.2 - 0.6.1

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