Ignore:
Timestamp:
Dec 25, 2007, 7:51:07 PM (14 years ago)
Author:
Peter Johansson
Message:

moving more stuff to base class and add class for Blame Statistics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/ClassicStats.cc

    r529 r531  
    6262
    6363
    64   void ClassicStats::add(const std::string& user, const u_int& rev,
    65                          const Parser::line_type& lt)
    66   {
    67     assert(user.size());
    68     add_author(user);
    69 
    70     std::vector<u_int>* total = &(total_[user]);
    71     assert(total);
    72     if (total->size() < rev+1){
    73       total->reserve(revision() + 1);
    74       total->insert(total->end(), rev - total->size(), 0);
    75       total->push_back(1);
    76     }
    77     else
    78       ++(*total)[rev];
    79 
    80     std::vector<u_int>* code = &(code_[user]);
    81     assert(code);
    82     if (code->size() < rev+1){
    83       code->reserve(revision() + 1);
    84       code->insert(code->end(), rev - code->size(), 0);
    85       if (lt == Parser::code)
    86         code->push_back(1);
    87       else
    88         code->push_back(0);
    89     }
    90     else if (lt == Parser::code)
    91       ++(*code)[rev];
    92 
    93     std::vector<u_int>* comments = &(comments_[user]);
    94     assert(comments);
    95     if (comments->size() < rev+1){
    96       comments->reserve(revision() + 1);
    97       comments->insert(comments->end(), rev - comments->size(), 0);
    98       if (lt == Parser::comment)
    99         comments->push_back(1);
    100       else
    101         comments->push_back(0);
    102     }
    103     else if (lt == Parser::comment)
    104       ++(*comments)[rev];
    105 
    106     std::vector<u_int>* other = &(other_[user]);
    107     assert(other);
    108     if (other->size() < rev+1){
    109       other->reserve(revision() + 1);
    110       other->insert(other->end(), rev - other->size(), 0);
    111       if (lt == Parser::other)
    112         other->push_back(1);
    113       else
    114         other->push_back(0);
    115     }
    116     else if (lt == Parser::other)
    117       ++(*other)[rev];
    118   }
    119 
    120 
    12164  void ClassicStats::do_parse(const std::string& path)
    12265  {
Note: See TracChangeset for help on using the changeset viewer.