source: trunk/lib/LogIterator.cc @ 450

Last change on this file since 450 was 450, checked in by Jari Häkkinen, 14 years ago

Added missing #include <cassert>.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1// $Id: LogIterator.cc 450 2007-08-16 20:22:04Z jari $
2
3/*
4  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
5
6  This file is part of svndigest, http://trac.thep.lu.se/trac/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#include "LogIterator.h"
25
26#include "SVNlog.h"
27
28#include <cassert>
29
30namespace theplu{
31namespace svndigest{
32
33  LogIterator::LogIterator(const SVNlog& log, size_t index)
34    : log_(log), index_(index) 
35  {}
36
37 
38  LogIterator::~LogIterator()
39  {
40    if (commit_)
41      delete commit_;
42  }
43
44
45  bool LogIterator::operator<(const LogIterator& other) const
46  {
47    return index_<other.index_;
48  }
49
50
51  const Commitment& LogIterator::operator*()
52  {
53    assert(index_<log_.revision().size());
54    if (!commit_)
55      commit_ = new Commitment(log_.author()[index_], 
56                              log_.date()[index_], 
57                              log_.message()[index_], 
58                              log_.revision()[index_]);
59    return *commit_;
60  }
61
62
63  const Commitment* LogIterator::operator->(void)
64  {
65    return &this->operator*();
66  }
67
68
69  LogIterator& LogIterator::operator++(void)
70  {
71    if (index_<log_.revision().size()){
72      ++index_;
73      delete commit_;
74      commit_ = NULL;
75    }                               
76   
77    return *this;
78  }
79
80}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.