Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r42 r44 5 5 #include "utility.h" 6 6 7 #include <cstdio>8 #include <fstream>9 10 7 #include <algorithm> 11 8 #include <map> … … 13 10 #include <sstream> 14 11 #include <string> 12 #include <unistd.h> 15 13 #include <utility> 16 14 #include <vector> 17 18 #include <iostream>19 15 20 16 namespace theplu{ … … 69 65 std::string Stats::plot(void) const 70 66 { 71 char name[]="svnstatXXXXXX"; 72 if (!strlen(mktemp(name))) { 73 std::cerr << "Failed to get unique filename: " << name << std::endl; 74 exit(-1); 75 } 76 std::string cmd=std::string("set term png; set output '")+name+".png'"; 67 char name[]="svnstat_XXXXXX.png"; 68 if (mkstemps(name,4)==-1) 69 throw std::runtime_error(std::string("Failed to get unique filename: ") + 70 name); 71 std::string cmd=std::string("set term png; set output '")+name+"'"; 77 72 gnuplot_pipe_.command(cmd); 78 73 gnuplot_pipe_.command("set key left Left reverse"); … … 95 90 gnuplot_pipe_.command(cmd); 96 91 gnuplot_pipe_.command("replot"); 97 return std::string(name)+".png"; 98 } 99 100 void Stats::print(std::ostream& os) const 101 { 102 os << "<p><img src='" << plot() << "' alt='[svnstat plot]' border=0></p>\n"; 92 return name; 103 93 } 104 94 -
trunk/lib/Stats.h
r41 r44 5 5 6 6 #include <map> 7 #include <ostream> 7 8 #include <string> 8 9 #include <vector> … … 30 31 31 32 /// 32 /// @b ief print statistics33 /// @brief Print statistics 33 34 /// 34 void print(std::ostream&) const; 35 void inline print(std::ostream& s) const 36 { s << "<p><img src='" << plot() << "' alt='[plot]' border=0></p>\n"; } 35 37 36 38 ///
Note: See TracChangeset
for help on using the changeset viewer.