Changeset 256 for trunk/lib/html_utility.cc
- Timestamp:
- Apr 30, 2007, 1:17:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/html_utility.cc
r254 r256 24 24 #include "html_utility.h" 25 25 26 #include "Commitment.h" 26 27 #include "Date.h" 27 28 #include "HtmlStream.h" … … 239 240 240 241 using namespace std; 241 map<string, Date> latest_commit_date; 242 assert(log.author().size()==log.date().size()); 243 typedef vector<string>::const_iterator iter; 244 iter d=log.date().begin(); 245 for (iter a=log.author().begin(); 246 a!=log.author().end(); ++a, ++d) { 247 latest_commit_date[*a]=Date(*d); 248 } 242 set<string> authors; 243 authors.insert(log.author().begin(), log.author().end()); 249 244 // erase invalid authors 250 latest_commit_date.erase(""); 251 latest_commit_date.erase("no author"); 252 253 // vector of authors & date sorted with respect to date 254 typedef vector<pair<string, Date> > vector; 255 vector author_date; 256 author_date.reserve(latest_commit_date.size()); 257 back_insert_iterator<vector> i(author_date); 258 copy(latest_commit_date.begin(), latest_commit_date.end(), i); 259 sort(author_date.begin(), author_date.end(), 260 pair_value_compare<string,Date>()); 261 262 print_general_information(os, log, author_date.size()); 263 print_authors(os, author_date, log, stats); 245 authors.erase(""); 246 authors.erase("no author"); 247 248 vector<Commitment> latest_commit; 249 latest_commit.reserve(authors.size()); 250 for (set<string>::const_iterator i(authors.begin()); i!=authors.end(); ++i) 251 latest_commit.push_back(log.latest_commit(*i)); 252 253 print_general_information(os, log, authors.size()); 254 sort(latest_commit.begin(), latest_commit.end(), GreaterRevision()); 255 print_authors(os, latest_commit, stats); 264 256 print_recent_logs(os, log); 265 257 os << "<hr width=100% />"; … … 375 367 376 368 void print_authors(std::ostream& os, 377 const std::vector< std::pair<std::string,Date> >& auth_date,378 const S VNlog& log, const Stats& stats)369 const std::vector<Commitment>& lc, 370 const Stats& stats) 379 371 { 380 372 os << "<div class=\"main\">" … … 392 384 std::string timefmt("%b %d %H:%M:%S %Y"); 393 385 using namespace std; 394 for (vector<pair<string,Date> >::const_reverse_iterator i=auth_date.rbegin(); 395 i!=auth_date.rend(); ++i) { 386 for (vector<Commitment>::const_iterator i=lc.begin(); i!=lc.end(); ++i) { 396 387 os << "<tr><td>" 397 << anchor(string(i-> first+"/total/index.html"),i->first)398 << "</td><td>" << stats.lines(i-> first) << " ("399 << 100*stats.lines(i-> first)/stats.lines() << "%)</td>"400 << "<td>" << stats.code(i-> first) << " ("401 << 100*stats.code(i-> first)/stats.code() << "%)</td>"402 << "<td>" << stats.comments(i-> first) << " ("403 << 100*stats.comments(i-> first)/stats.comments() << "%)</td>"404 << "<td>" << i-> second(timefmt) << "</td>"388 << anchor(string(i->author()+"/total/index.html"),i->author()) 389 << "</td><td>" << stats.lines(i->author()) << " (" 390 << 100*stats.lines(i->author())/stats.lines() << "%)</td>" 391 << "<td>" << stats.code(i->author()) << " (" 392 << 100*stats.code(i->author())/stats.code() << "%)</td>" 393 << "<td>" << stats.comments(i->author()) << " (" 394 << 100*stats.comments(i->author())/stats.comments() << "%)</td>" 395 << "<td>" << i->date()(timefmt) << "</td>" 405 396 <<"</tr>"; 406 397 }
Note: See TracChangeset
for help on using the changeset viewer.