Changeset 256
- Timestamp:
- Apr 30, 2007, 1:17:36 PM (16 years ago)
- Location:
- trunk/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Commitment.cc
r255 r256 23 23 24 24 #include "Commitment.h" 25 #include "Date.h" 25 26 26 27 #include <string> … … 30 31 31 32 32 Commitment::Commitment(std::string author, std::string date, 33 Commitment::Commitment(void) 34 { 35 } 36 37 38 Commitment::Commitment(std::string author, const Date& date, 33 39 std::string msg, size_t rev) 34 40 : author_(author), date_(date), msg_(msg), rev_(rev) -
trunk/lib/Commitment.h
r255 r256 25 25 */ 26 26 27 #include "Date.h" 28 27 29 #include <string> 28 30 … … 40 42 41 43 /** 44 \brief Default contructor. 45 */ 46 Commitment(void); 47 48 /** 42 49 \brief The contructor. 43 50 */ 44 Commitment(std::string author, std::stringdate, std::string msg,51 Commitment(std::string author, const Date& date, std::string msg, 45 52 size_t rev); 46 53 … … 53 60 \return Date 54 61 */ 55 inline std::stringdate(void) const { return date_; }62 inline const Date& date(void) const { return date_; } 56 63 57 64 /** … … 73 80 74 81 std::string author_; 75 std::stringdate_;82 Date date_; 76 83 std::string msg_; 77 84 size_t rev_; … … 79 86 }; 80 87 88 89 struct GreaterRevision 90 { 91 inline bool operator()(const Commitment& lhs, const Commitment& rhs) 92 { return lhs.revision()>rhs.revision(); } 93 }; 94 81 95 }} // end of namespace svndigest and namespace theplu 82 96 -
trunk/lib/SVNlog.cc
r234 r256 23 23 24 24 #include "SVNlog.h" 25 26 #include "Commitment.h" 25 27 #include "SVN.h" 26 28 … … 48 50 } 49 51 52 53 Commitment SVNlog::latest_commit(std::string name) const 54 { 55 std::vector<std::string>::const_reverse_iterator iter = 56 find(author().rbegin(), author().rend(), name); 57 size_t dist(std::distance(iter, author().rend())); 58 if (!dist) { 59 Commitment c; 60 return c; 61 } 62 return Commitment(author()[dist-1], Date(date()[dist-1]), 63 message()[dist-1], revision()[dist-1]); 64 65 } 50 66 51 67 }} // end of namespace svndigest and namespace theplu -
trunk/lib/SVNlog.h
r253 r256 26 26 27 27 #include "SVN.h" 28 29 #include "Commitment.h" 28 30 29 31 #include <string> … … 77 79 78 80 /** 81 \return Latest commit \a author did. If no author is found an 82 empty Commitment (default constructor) is returned. 83 */ 84 Commitment latest_commit(std::string author) const; 85 86 /** 79 87 \return Revisions 80 88 */ -
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 } -
trunk/lib/html_utility.h
r236 r256 35 35 namespace svndigest{ 36 36 37 class Commitment; 37 38 class Date; 38 39 class Stats; … … 57 58 58 59 void print_authors(std::ostream& os, 59 const std::vector< std::pair<std::string, Date> >&,60 const S VNlog&, const Stats& stats);60 const std::vector<Commitment>& latest_commit, 61 const Stats& stats); 61 62 62 63 /// … … 70 71 void print_main_page(const std::string&, const SVNlog&, const Stats&); 71 72 72 void print_recent_logs(std::ostream&, const SVNlog& );73 void print_recent_logs(std::ostream&, const SVNlog& log); 73 74 74 75 ///
Note: See TracChangeset
for help on using the changeset viewer.