Changeset 23 for trunk/lib/File.cc
- Timestamp:
- Jan 2, 2006, 9:14:57 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/File.cc
r16 r23 22 22 } 23 23 24 void File::info(void) 25 { 26 std::string system_call = "svn info " + path_ + " > svnstat.tmp"; 27 int system_return = system(system_call.c_str()); 28 if (system_return){ 29 // Jari, throw exception. 30 std::cerr << "svnstat: svn info " << path_ << std::endl; 31 exit(-1); 32 } 33 std::ifstream is("svnstat.tmp"); 34 std::string line; 35 while (getline(is,line)){ 36 std::stringstream ss(line); 37 std::string tag; 38 getline(ss,tag,':'); 39 if (tag == std::string("Last Changed Author")) 40 ss >> author_; 41 else if (tag == std::string("Last Changed Rev")) 42 ss >> revision_; 43 } 44 } 45 46 24 47 const Stats& File::parse(void) 25 48 { 26 49 stats_.reset(); 50 info(); 51 27 52 if (binary_){ 28 53 stats_.add(author_,revision_); … … 41 66 getline(is,line,' '); 42 67 if (line==std::string("binary")){ 43 is.close();44 binary_ = true;45 return parse();68 is.close(); 69 binary_ = true; 70 return parse(); 46 71 } 47 72 } … … 51 76 while (getline(is,line, '\n')){ 52 77 if (!line.size()) // skip empty line 53 continue;78 continue; 54 79 std::stringstream ss(line); 55 80 u_int revision; … … 63 88 } 64 89 65 void File::print(void) { 66 // Jari, temporary using this to print directory tree 67 std::cout << "File '" << path_ << "'" << std::endl; 90 void File::print(const std::string& path) const 91 { 92 std::string output(path + name() + ".html"); 93 std::ofstream os(output.c_str()); 94 print_header(os); 95 os << std::endl; 96 stats_.print(os); 97 os << std::endl; 98 print_footer(os); 99 os.close(); 100 101 } 102 103 void File::print_link(std::ostream& os) const 104 { 105 os << "<a href=\"" << name() << ".html\">" << name() << "</a>"; 68 106 } 69 107
Note: See TracChangeset
for help on using the changeset viewer.