Changeset 23 for trunk/lib/Directory.cc
- Timestamp:
- Jan 2, 2006, 9:14:57 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Directory.cc
r22 r23 6 6 7 7 #include <algorithm> 8 #include <fstream> 8 9 #include <iostream> 9 10 #include <iterator> … … 70 71 71 72 72 void Directory::print(void) { 73 // Jari, temporary using this to print directory tree 74 for_each(daughters_.begin(),daughters_.end(), std::mem_fun(&Node::print)); 73 void Directory::print(const std::string& path) const 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"); 79 std::ofstream os(output.c_str()); 80 print_header(os); 81 os << std::endl; 82 stats_.print(os); 83 os << std::endl; 84 85 for (NodeConstIter_ i=daughters_.begin();i!=daughters_.end();i++){ 86 (*i)->print_link(os); 87 os << "<br/>" << std::endl; 88 } 89 90 print_footer(os); 91 os.close(); 92 93 for (NodeConstIter_ i=daughters_.begin();i!=daughters_.end();i++) 94 (*i)->print(path+name()+"/"); 95 } 96 97 void Directory::print_link(std::ostream& os) const 98 { 99 os << "<a href=\"" << name() << "/index.html\">" << name() << "</a>"; 75 100 } 76 101
Note: See TracChangeset
for help on using the changeset viewer.