source: trunk/lib/SVNinfo.h @ 693

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

Fixes #339. Change to GPLv3.

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