source: trunk/lib/Node.cc @ 48

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

added class for keeping stats from svn log

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1// $Id: Node.cc 48 2006-01-13 21:37:26Z peter $
2
3#include "Node.h"
4#include "utility.h"
5
6#include <ctime>
7#include <fstream>
8#include <iostream>
9#include <sstream>
10#include <ctime>
11
12namespace theplu{
13namespace svnstat{
14
15  Node::Node(const std::string& path, const std::string& output) 
16    : path_(path)
17  {
18    output_name_ = output + name(); 
19  }
20
21
22  std::string Node::name(void) const
23  {
24    std::stringstream ss(path_);
25    std::string name;
26    while (getline(ss,name,'/')) {}
27    return name;
28  }
29
30
31  void Node::print_footer(std::ostream& os) const
32  {
33    time_t rawtime;
34    struct tm * timeinfo;
35    time ( &rawtime );
36    timeinfo = localtime ( &rawtime );
37    os << "<p><font size=1>Generated on "
38       << asctime (timeinfo) 
39       << "by svnstat</font></p></body>\n" 
40       << "</html>";
41  }
42
43
44  void Node::print_header(std::ostream& os) const
45  {
46    os << "<html>\n"
47       << "<head>\n"
48       << "<title> svnstat " << name() << "\n"
49       << "</head>\n"
50       << "<body bgcolor='FFFBFB'\n";
51  }
52
53
54  bool Node::subversion_controlled(void) const
55  {
56    std::string system_call = "svn proplist " + path_ + ">&/dev/null";
57    return !system(system_call.c_str());
58  }
59
60}} // end of namespace svnstat and namespace theplu
Note: See TracBrowser for help on using the repository browser.