source: tags/0.6.8/lib/SVNinfo.h @ 848

Last change on this file since 848 was 731, checked in by Peter Johansson, 13 years ago

update copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1#ifndef _theplu_svndigest_svninfo_
2#define _theplu_svndigest_svninfo_
3
4// $Id: SVNinfo.h 731 2008-12-15 19:03:04Z peter $
5
6/*
7  Copyright (C) 2006 Jari Häkkinen
8  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2008 Peter Johansson
10
11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
12
13  svndigest is free software; you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 2 of the License, or
16  (at your option) any later version.
17
18  svndigest is distributed in the hope that it will be useful, but
19  WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
29#include <string>
30
31#include <subversion-1/svn_client.h>
32
33namespace theplu {
34namespace svndigest {
35
36  class SVN;
37
38  ///
39  /// The SVNinfo class is a utility class for taking care of 'svn
40  /// info'.
41  ///
42  class SVNinfo {
43  public:
44
45    ///
46    /// Retrieve meta information about the item with \a path.
47    ///
48    /// @note The recursivness of the underlying subversion API is not
49    /// allowed (nor supported).
50    ///
51    explicit SVNinfo(const std::string& path);
52
53    ///
54    /// @brief Get the repository root URL.
55    ///
56    inline const std::string& repos_root_url(void) const
57    { return info_receiver_baton_.repos_root_url_; }
58
59    ///
60    /// @brief Get the URL.
61    ///
62    inline std::string url(void) const
63    { return info_receiver_baton_.url_; }
64
65    ///
66    /// @brief Get the author of the latest commit.
67    ///
68    inline const std::string& last_changed_author(void) const
69    { return info_receiver_baton_.last_changed_author_; }
70
71    ///
72    /// @brief Get the revision of the latest commit.
73    ///
74    inline svn_revnum_t last_changed_rev(void) const
75    { return info_receiver_baton_.last_changed_rev_; }
76
77    ///
78    /// @brief Get the current revision of the item.
79    ///
80    inline svn_revnum_t rev(void) const { return info_receiver_baton_.rev_; }
81
82
83  private:
84
85    ///
86    /// @brief Copy Constructor, not implemented.
87    ///
88    SVNinfo(const SVNinfo&);
89
90    ///
91    /// svn info is stored in the info_receiver_baton_. The
92    /// information is retrieved with the info_* set of member
93    /// functions. The struct is filled in the info_receiver function.
94    ///
95    /// @see info_receiver
96    ///
97    struct info_receiver_baton {
98      // more info is available but we only use these
99      std::string url_;
100      std::string repos_root_url_;
101      std::string last_changed_author_;
102      svn_revnum_t last_changed_rev_;
103      svn_revnum_t rev_;
104    } info_receiver_baton_ ;
105
106    ///
107    /// info_receiver is the function passed to the underlying
108    /// subversion API. This function is called by the subversion API
109    /// for every item matched by the conditions of the API call.
110    ///
111    /// @see Subversion API documentation
112    ///
113    // The return type should be svn_log_message_receiver_t but I
114    // cannot get it to compile (see comment for log_message_receiver
115    // in SVNlog.h)
116    static svn_error_t * info_receiver(void *baton, const char *path,
117                                       const svn_info_t *info, apr_pool_t *pool);
118  };
119
120}} // end of namespace svndigest and namespace theplu
121
122#endif
Note: See TracBrowser for help on using the repository browser.