// $Id: Node.cc 182 2006-09-03 08:46:34Z peter $ /* Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest svndigest is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. svndigest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "Node.h" #include "html_utility.h" #include "utility.h" #include // this header file is created by configure #include #include #include #include namespace theplu{ namespace svndigest{ Node::Node(const u_int level, const std::string& path, const std::string& output="") : level_(level), path_(path), stats_(path), svninfo_(path) { output_name_ = output+file_name(path_); } bool Node::dir(void) const { return false; } void Node::path_anchor(std::ostream& os) const { std::vector words; words.reserve(level_+1); std::string word; std::stringstream ss(output_name()); while(getline(ss,word,'/')) words.push_back(word); for (size_t i=0; i/\n"; } anchor(os,href(), words.back(), level_+2-words.size(), "View " + words.back()); } void Node::html_tablerow(std::ostream& os, const std::string& css_class) const { os << "\n" << ""; if (binary()) os << name() << " (binary)"; else anchor(os,href(), name()); os << "\n" << "" << stats_.lines() << "\n" << "" << stats_.code() << "\n" << "" << stats_.comments() << "\n" << "" << stats_.last_changed_rev() << "\n" << "" << author() << "\n" << "\n"; } void Node::print_footer(std::ostream& os) const { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = gmtime ( &rawtime ); os << "

\nGenerated on " << asctime (timeinfo) << " (UTC) by "; anchor(os, "http://lev.thep.lu.se/trac/svndigest/", PACKAGE_STRING); os << "\n

\n\n\n\n"; } void Node::print_header(std::ostream& os) const { os << "\n" << "\n" << "\n" << " svndigest " << name() << "\n" << "\n" << "\n" << "\n" << "
" << "
  • " << "
  • "; anchor(os, "index.html", "Home", level_, "Main page"); os << "
  • " << "
" << "
\n" << "

\n"; path_anchor(os); os << "\n

\n"; } }} // end of namespace svndigest and namespace theplu