Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Directory.cc
r23 r29 18 18 namespace svnstat{ 19 19 20 Directory::Directory(const std::string& path )21 : Node(path )20 Directory::Directory(const std::string& path, const std::string& output) 21 : Node(path,output) 22 22 { 23 23 using namespace std; … … 47 47 lstat(fullpath.c_str(),&nodestat); // C api from sys/stat.h 48 48 if (S_ISDIR(nodestat.st_mode)) // C api from sys/stat.h 49 daughters_.push_back(new Directory(fullpath ));49 daughters_.push_back(new Directory(fullpath, output_name_+"_")); 50 50 else 51 daughters_.push_back(new File(fullpath ));51 daughters_.push_back(new File(fullpath,output_name_+"_")); 52 52 } 53 53 } … … 73 73 void Directory::print(const std::string& path) const 74 74 { 75 // Peter, creation of dir should be done without system call 76 std::string system_call("mkdir " + path + name()+">& /dev/null"); 77 system(system_call.c_str()); 78 std::string output(path + name() + "/index.html"); 75 std::string output(path + output_name_ + ".html"); 79 76 std::ofstream os(output.c_str()); 80 77 print_header(os); … … 91 88 os.close(); 92 89 90 // Peter, use STL algo. 93 91 for (NodeConstIter_ i=daughters_.begin();i!=daughters_.end();i++) 94 (*i)->print(path +name()+"/");92 (*i)->print(path); 95 93 } 96 97 void Directory::print_link(std::ostream& os) const98 {99 os << "<a href=\"" << name() << "/index.html\">" << name() << "</a>";100 }101 102 94 103 95 void Directory::purge(void) { -
trunk/lib/Directory.h
r23 r29 30 30 /// traversed. 31 31 /// 32 Directory(const std::string& path );32 Directory(const std::string& path, const std::string& output=""); 33 33 34 34 /// … … 40 40 41 41 void print(const std::string&) const; 42 43 void print_link(std::ostream&) const;44 42 45 43 void purge(void); -
trunk/lib/File.cc
r23 r29 90 90 void File::print(const std::string& path) const 91 91 { 92 std::string output(path + name()+ ".html");92 std::string output(path + output_name_ + ".html"); 93 93 std::ofstream os(output.c_str()); 94 94 print_header(os); … … 101 101 } 102 102 103 void File::print_link(std::ostream& os) const104 {105 os << "<a href=\"" << name() << ".html\">" << name() << "</a>";106 }107 108 103 }} // end of namespace svnstat and namespace theplu -
trunk/lib/File.h
r23 r29 17 17 /// @brief Default Constructor 18 18 /// 19 inline File(const std::string& path) : Node(path), binary_(false) {} 19 File(const std::string& path, const std::string& output="") 20 : Node(path,output), binary_(false) {} 20 21 21 22 /// … … 30 31 /// 31 32 void print(const std::string& path) const; 32 33 ///34 ///35 ///36 void print_link(std::ostream&) const;37 33 38 34 private: -
trunk/lib/Node.cc
r23 r29 11 11 namespace theplu{ 12 12 namespace svnstat{ 13 14 Node::Node(const std::string& path, const std::string& output) 15 : path_(path) 16 { 17 output_name_ = output + name(); 18 } 19 13 20 14 21 std::string Node::name(void) const -
trunk/lib/Node.h
r23 r29 6 6 #include "Stats.h" 7 7 8 #include <ostream> 8 9 #include <string> 9 10 … … 20 21 /// @brief Constructor 21 22 /// 22 inline Node(const std::string& path) : path_(path) {}23 Node(const std::string& path, const std::string& output=""); 23 24 24 25 /// … … 40 41 /// Prints a html link. 41 42 /// 42 virtual void print_link(std::ostream&) const=0; 43 43 inline void print_link(std::ostream& os) const 44 { os << "<a href=\"" << output_name_ << ".html\">" << name() << "</a>"; } 45 44 46 /// 45 47 /// 46 48 /// 47 // Peter to Jari, inlining virtual functions?48 49 inline virtual void purge(void) { /* Nothing to be done */ }; 49 50 … … 74 75 void print_header(std::ostream&) const; 75 76 77 std::string output_name_; //without suffix 76 78 std::string path_; 77 79 Stats stats_; … … 82 84 /// 83 85 Node(const Node&); 86 84 87 }; 85 88
Note: See TracChangeset
for help on using the changeset viewer.