source: trunk/lib/File.cc @ 63

Last change on this file since 63 was 63, checked in by Peter Johansson, 16 years ago

Fixed problem with mapping revison to date. Removed mkstemps. name of
png files are now in line with their html file name. Binary works on
svnstat, but is asserted on c++_tools.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 998 bytes
Line 
1// $Id: File.cc 63 2006-01-19 23:07:36Z peter $
2
3#include "File.h"
4#include "Node.h"
5#include "Stats.h"
6#include "utility.h"
7
8#include <fstream>
9#include <iostream>
10#include <map>
11#include <sstream>
12#include <string>
13
14namespace theplu{
15namespace svnstat{
16
17  const Stats& File::parse(const bool verbose)
18  {
19    if (verbose)
20      std::cout << "Parsing " << path_ << std::endl; 
21    stats_.reset();
22
23    std::map<std::string,std::string> svn_info = info(path_);
24    author_ = svn_info["Last Changed Author"];
25    std::stringstream ss(svn_info["Last Changed Rev"]);
26    ss >> revision_;
27
28    binary_ = stats_.parse(path_, binary_);
29    return stats_;
30  }
31
32  void File::print(const bool verbose) const 
33  {
34    std::string output(output_name() + ".html");
35    if (verbose)
36      std::cout << "Printing output for " << path_ << std::endl;
37    std::ofstream os(output.c_str());
38    print_header(os);
39    os << std::endl;
40    stats_.print(os,output_name()+".png");
41    os << std::endl;
42    print_footer(os);
43    os.close(); 
44
45  }
46
47}} // end of namespace svnstat and namespace theplu
Note: See TracBrowser for help on using the repository browser.