source: trunk/lib/SVNlog.h @ 448

Last change on this file since 448 was 448, checked in by Peter Johansson, 14 years ago

adding LogIterator?

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.8 KB
RevLine 
[233]1#ifndef _theplu_svndigest_svnlog_
2#define _theplu_svndigest_svnlog_
3
4// $Id: SVNlog.h 448 2007-08-16 18:44:46Z peter $
5
6/*
[408]7  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
[233]8
[439]9  This file is part of svndigest, http://trac.thep.lu.se/trac/svndigest
[233]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
[256]29#include "Commitment.h"
30
[233]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 stored in vectors.
45  */
46  class SVNlog {
47  public:
48
49    /**
[448]50       Default constructor. Creates empty log.
51     */
52    SVNlog(void);
53
54    /**
[233]55       \brief The contructor.
56       
57       The constructor performs an 'svn log' on \a path and
58       stores the information for later access.
59    */
[318]60    explicit SVNlog(const std::string& path);
[233]61
62    /**
63       \brief The destructor.
64    */
65    ~SVNlog(void);
66
67    /**
[253]68       \return Authors
[233]69    */
70    inline const std::vector<std::string>& author(void) const
71    { return lb_.authors; }
72
73    /**
[253]74       \return Dates
[233]75    */
[253]76    inline const std::vector<std::string>& date(void) const
[233]77    { return lb_.commit_dates; }
78
79    /**
[282]80       \return true if \a author appears in log.
81    */
82    bool exist(std::string author) const;
83
84    /**
[253]85       \return Messages
[233]86    */
[253]87    inline const std::vector<std::string>& message(void) const
[233]88    { return lb_.msg; }
89
90    /**
[259]91       \return Latest commit
92    */
93    Commitment latest_commit(void) const;
94
95    /**
[256]96       \return Latest commit \a author did. If no author is found an
97       empty Commitment (default constructor) is returned.
98    */
99    Commitment latest_commit(std::string author) const;
100
101    /**
[233]102       \return Revisions
103    */
[253]104    inline const std::vector<size_t>& revision(void) const
[233]105    { return lb_.rev; }
106
107  private:
108
109    ///
110    /// @brief Copy Constructor, not implemented.
111    ///
[447]112    // using compiler generated copy constructor
113    //SVNlog(const SVNlog&);
[233]114
[318]115    /**
116       log information is stored in the log_receiver_baton. The
117       information is retrieved with the info_* set of member
118       functions. The struct is filled in the info_receiver function.
[233]119
[318]120       \see info_receiver
121    */
122    struct log_receiver_baton {
123      std::vector<std::string> authors;
124      std::vector<std::string> commit_dates;
125      std::vector<std::string> msg;
126      std::vector<size_t> rev;
127    } lb_;
128
129    /**
130       info_receiver is the function passed to the underlying
131       subversion API. This function is called by the subversion API
132       for every item matched by the conditions of the API call.
133
134       \see Subversion API documentation
135    */
136    // The return type should be svn_log_message_receiver_t but I
137    // cannot get it to compile. The svn API has a typedef like
138    // typedef svn_error_t*(* svn_log_message_receiver_t)(void *baton,
139    // apr_hash_t *changed_paths, svn_revnum_t revision, const char
140    // *author, const char *date,const char *message, apr_pool_t
141    // *pool) for svn_log_message_receiver_t.
142    static svn_error_t*
143    log_message_receiver(void *baton, apr_hash_t *changed_paths,
144                         svn_revnum_t rev, const char *author, const char *date,
145                         const char *msg, apr_pool_t *pool);
[233]146  };
147
[448]148  /**
149   */
150  //SVNlog& operator+=(SVNlog&, const SVNlog&);
151
[233]152}} // end of namespace svndigest and namespace theplu
153
154#endif
Note: See TracBrowser for help on using the repository browser.