source: branches/replacing_gnuplot/lib/SVNlog.h @ 646

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

Merged trunk changes r608:645 to replacing_gnuplot branch.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1#ifndef _theplu_svndigest_svnlog_
2#define _theplu_svndigest_svnlog_
3
4// $Id: SVNlog.h 646 2008-06-03 22:05:22Z jari $
5
6/*
7  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
8
9  This file is part of svndigest, http://trac.thep.lu.se/svndigest
10
11  svndigest is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation; either version 2 of the License, or
14  (at your option) any later version.
15
16  svndigest is distributed in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include "SVN.h"
28
29#include "Commitment.h"
30
31#include <string>
32#include <vector>
33
34#include <subversion-1/svn_client.h>
35
36namespace theplu {
37namespace svndigest {
38
39  class SVN;
40
41  /**
42     The SVNlog class is a utility class for taking care of 'svn
43     log' information. An 'svn log' is performed on an item, the
44     log information for each revision is a vector<Commitment>.
45  */
46  class SVNlog {
47  public:
48    /**
49       Default constructor. Creates empty log.
50     */
51    SVNlog(void);
52
53    /**
54       \brief The contructor.
55       
56       The constructor performs an 'svn log' on \a path and
57       stores the information for later access.
58    */
59    explicit SVNlog(const std::string& path);
60
61    /**
62       \brief The destructor.
63    */
64    ~SVNlog(void);
65
66    /**
67       \return Commitments
68    */
69    inline const std::vector<Commitment>& commits(void) const
70    { return lb_.commits; }
71
72    /**
73       \return Commitments
74    */
75    inline std::vector<Commitment>& commits(void)
76    { return lb_.commits; }
77
78    /**
79       \return true if \a author appears in log.
80    */
81    bool exist(std::string author) const;
82
83    /**
84       \return Latest commit
85    */
86    const Commitment& latest_commit(void) const;
87
88    /**
89       \return Latest commit \a author did. If no author is found an
90       empty Commitment (default constructor) is returned.
91    */
92    const Commitment& latest_commit(std::string author) const;
93
94    /**
95     */
96    void swap(SVNlog&);
97   
98  private:
99
100    ///
101    /// @brief Copy Constructor, not implemented.
102    ///
103    // using compiler generated copy constructor
104    //SVNlog(const SVNlog&);
105
106    /**
107       log information is stored in the log_receiver_baton. The
108       information is retrieved with the info_* set of member
109       functions. The struct is filled in the info_receiver function.
110
111       \see info_receiver
112    */
113    struct log_receiver_baton {
114      std::vector<Commitment> commits;
115    } lb_;
116
117    /**
118       info_receiver is the function passed to the underlying
119       subversion API. This function is called by the subversion API
120       for every item matched by the conditions of the API call.
121
122       \see Subversion API documentation
123    */
124    // The return type should be svn_log_message_receiver_t but I
125    // cannot get it to compile. The svn API has a typedef like
126    // typedef svn_error_t*(* svn_log_message_receiver_t)(void *baton,
127    // apr_hash_t *changed_paths, svn_revnum_t revision, const char
128    // *author, const char *date,const char *message, apr_pool_t
129    // *pool) for svn_log_message_receiver_t.
130    static svn_error_t*
131    log_message_receiver(void *baton, apr_hash_t *changed_paths,
132                         svn_revnum_t rev, const char *author, const char *date,
133                         const char *msg, apr_pool_t *pool);
134  };
135
136  /**
137   */
138  SVNlog& operator+=(SVNlog&, const SVNlog&);
139
140}} // end of namespace svndigest and namespace theplu
141
142#endif
Note: See TracBrowser for help on using the repository browser.