Changeset 653 for trunk


Ignore:
Timestamp:
Jun 8, 2008, 6:29:24 AM (13 years ago)
Author:
Peter Johansson
Message:

refs #328 adding a map from year2last_rev - I only wanna create this function once so I create an extra layer and put the creation of map in the intermediate layer.

Location:
trunk/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r589 r653  
    255255
    256256  void Directory::print_copyright(std::map<std::string, Alias>& alias,
    257                                   bool verbose) const {
     257                                  bool verbose,
     258                                  const std::map<int,svn_revnum_t>& y2r) const {
    258259    if (!ignore()){
    259260      // print daughter nodes, i.e, this function is recursive
    260261      for (NodeConstIterator i = daughters_.begin(); i!=daughters_.end(); ++i)
    261         (*i)->print_copyright(alias, verbose);
     262        (*i)->print_copyright(alias, verbose, y2r);
    262263    }
    263264  }
  • trunk/lib/Directory.h

    r589 r653  
    8383    const StatsCollection& parse(bool verbose, bool ignore);
    8484
    85     void print_copyright(std::map<std::string, Alias>&, bool verbose) const;
     85    using Node::print_copyright;
     86    /**
     87       virtual function typically called from Node::print_copyright
     88    */
     89    void print_copyright(std::map<std::string, Alias>&, bool verbose,
     90                         const std::map<int, svn_revnum_t>&) const;
    8691
    8792  private:
  • trunk/lib/File.cc

    r642 r653  
    286286
    287287  void File::print_copyright(std::map<std::string, Alias>& alias,
    288                              bool verbose) const
     288                             bool verbose,
     289                             const std::map<int,svn_revnum_t>& y2rev) const
    289290  {
    290291    if (ignore())
  • trunk/lib/File.h

    r589 r653  
    6666    const StatsCollection& parse(bool verbose, bool ignore);
    6767
     68    using Node::print_copyright;
    6869    /**
    6970       @throw std::runtime_error when a file error is encountered
    7071       updating the copyrights.
    7172    */
    72     void print_copyright(std::map<std::string, Alias>&, bool verbose) const;
     73    void print_copyright(std::map<std::string, Alias>&, bool verbose,
     74                         const std::map<int, svn_revnum_t>&) const;
    7375
    7476  private:
  • trunk/lib/Node.cc

    r642 r653  
    304304
    305305 
     306  void Node::print_copyright(std::map<std::string,Alias>& alias,
     307                             bool verbose) const
     308  {
     309    // map with last rev for every year
     310    std::map<int, svn_revnum_t> year2rev;
     311    SVNlog log(path());
     312    typedef std::vector<Commitment>::const_iterator LogIterator;
     313    for (LogIterator i=log.commits().begin(); i<log.commits().end(); ++i){
     314      time_t sec = str2time(i->date());
     315      tm* timeinfo = gmtime(&sec);
     316      year2rev[timeinfo->tm_year] = i->revision();
     317    }
     318    print_copyright(alias, verbose, year2rev);
     319  }
     320
     321
    306322  std::string Node::url(void) const
    307323  {
  • trunk/lib/Node.h

    r589 r653  
    170170                              const SVNlog&) const;
    171171
    172     virtual void print_copyright(std::map<std::string,Alias>&, bool) const=0;
     172    /**
     173       creates a map from year to last rev for that year and call
     174       virtual function.
     175     */
     176    void print_copyright(std::map<std::string,Alias>&, bool) const;
     177
     178    /**
     179       typically called from function above
     180     */
     181    virtual void print_copyright(std::map<std::string,Alias>&, bool,
     182                                 const std::map<int,svn_revnum_t>&) const=0;
    173183
    174184    /**
Note: See TracChangeset for help on using the changeset viewer.