Changeset 202 for trunk/lib


Ignore:
Timestamp:
Sep 10, 2006, 9:39:53 AM (17 years ago)
Author:
Peter Johansson
Message:

refs #70 added Map containing empty line stats in Stats class.

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Stats.cc

    r185 r202  
    123123    else if (lt == Parser::comment)
    124124      ++(*comments)[rev];
     125
     126    std::vector<u_int>* empty = &(empty_[user]);
     127    if (empty->size() < rev+1){
     128      empty->reserve(revision_ + 1);
     129      empty->insert(empty->end(), rev - empty->size(), 0);
     130      if (lt == Parser::comment)
     131        empty->push_back(1);
     132      else
     133        empty->push_back(0);
     134    }
     135    else if (lt == Parser::comment)
     136      ++(*empty)[rev];
    125137  }
    126138
     
    140152      ++count;
    141153    }
     154   
    142155  }
    143156
     
    210223    }
    211224   
     225    for (MapConstIter_ o_i= other.empty_.begin();
     226         o_i != other.empty_.end(); ++o_i)
     227    {
     228      std::pair<MapIter_,bool> result = empty_.insert(*o_i);
     229      if (!result.second)
     230        empty_[(*(result.first)).first] =
     231          VectorPlus<u_int>()( (*(result.first)).second, (*o_i).second );
     232 
     233    }
     234   
    212235    for (MapConstIter_ o_i= other.total_.begin();
    213236         o_i != other.total_.end(); ++o_i)
  • trunk/lib/Stats.h

    r198 r202  
    7777
    7878    ///
     79    ///
     80    ///
     81    inline u_int empty(void) const { return accumulated(empty_).back(); }
     82
     83    ///
     84    ///
     85    ///
     86    inline u_int empty(const std::string& user) const
     87    { return accumulated(empty_, user).back(); }
     88
     89    ///
    7990    ///
    8091    ///
     
    92103    ///
    93104    inline void reset(void)
    94     { code_.clear(); comments_.clear(); total_.clear(); authors_.clear();}
     105    {
     106      code_.clear(); comments_.clear(); empty_.clear(); total_.clear();
     107      authors_.clear();}
    95108
    96109    ///
     
    156169    Map_ code_;
    157170    Map_ comments_;
     171    Map_ empty_;
    158172    Map_ total_;
    159173  };
Note: See TracChangeset for help on using the changeset viewer.