Changeset 552 for trunk/lib/Stats.h


Ignore:
Timestamp:
Jan 8, 2008, 3:40:37 PM (14 years ago)
Author:
Peter Johansson
Message:

fixes linetype Copyright

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Stats.h

    r537 r552  
    2727*/
    2828
    29 #include "Parser.h"
     29#include "LineTypeParser.h"
    3030
    3131#include <subversion-1/svn_types.h>
     
    6060    ///
    6161    void add(const std::string& user, const u_int& revision,
    62              const Parser::line_type&, u_int n=1);
     62             const LineTypeParser::line_type&, u_int n=1);
    6363
    6464    ///
     
    136136    Stats& operator+=(const Stats&);
    137137
    138 
     138    /**
     139       \return number of lines for \a author and \a linetype from
     140       revision \a rev.
     141
     142       \throw if \a author does not exist
     143     */
     144    size_t operator()(int linetype, std::string author, size_t rev) const;
    139145
    140146  protected:
     
    148154                     std::set<std::string>::const_iterator);
    149155
     156    // references to data
     157    inline Author2Vector& code_stats(void)
     158    { return stats_[LineTypeParser::code]; }
     159    inline Author2Vector& comment_stats(void)
     160    { return stats_[LineTypeParser::comment]; }
     161    inline Author2Vector& copyright_stats(void)
     162    { return stats_[LineTypeParser::copyright]; }
     163    inline Author2Vector& other_stats(void)
     164    { return stats_[LineTypeParser::other]; }
     165    inline Author2Vector& comment_or_copy_stats(void)
     166    { return stats_[LineTypeParser::comment_or_copy]; }
     167    inline Author2Vector& total_stats(void)
     168    { return stats_[LineTypeParser::total]; }
     169
     170    // const references to data
     171    inline const Author2Vector& code_stats(void) const
     172    { return stats_[LineTypeParser::code]; }
     173    inline const Author2Vector& comment_stats(void) const
     174    { return stats_[LineTypeParser::comment]; }
     175    inline const Author2Vector& copyright_stats(void) const
     176    { return stats_[LineTypeParser::copyright]; }
     177    inline const Author2Vector& other_stats(void) const
     178    { return stats_[LineTypeParser::other]; }
     179    inline const Author2Vector& comment_or_copy_stats(void) const
     180    { return stats_[LineTypeParser::comment_or_copy]; }
     181    inline const Author2Vector& total_stats(void) const
     182    { return stats_[LineTypeParser::total]; }
     183
    150184    /**
    151185       add range [\a first, \a last) to \a map
     
    160194    void plot_init(const std::string& output) const;
    161195
    162     Author2Vector total_;
    163     Author2Vector code_;
    164     Author2Vector comments_;
    165     Author2Vector other_;
    166196    std::set<std::string> authors_;
    167197
     
    174204    // Change this string if cache format is changed in such a way
    175205    // that all old cache files are obsolete.
    176     inline std::string end_of_cache(void) const
    177     {return "END OF OK CACHE FILE VERSION 4";}
    178     inline std::string code_cache(void) const {return "CACHE CODE";}
    179     inline std::string comments_cache(void) const {return "CACHE COMMENTS";}
    180     inline std::string other_cache(void) const {return "CACHE EMPTY";}
    181     inline std::string total_cache(void) const {return "CACHE TOTAL";}
    182 
    183    
     206    inline std::string cache_check_str(void) const
     207    {return "CACHE FILE VERSION 5";}
    184208
    185209    void calc_all(void);
     210    void calc_comment_or_copy(void);
    186211    void calc_total(void);
    187212    u_int get_back(const Author2Vector&, std::string user) const;
     
    192217    svn_revnum_t last_changed_rev_; // Should be the latest revision for file
    193218
     219    std::vector<Author2Vector> stats_; // from linetype to a2v
    194220
    195221    // using compiler generated copy constructor
Note: See TracChangeset for help on using the changeset viewer.