source: tags/0.6/lib/SVNinfo.h @ 416

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

updating 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 408 2007-06-29 10:08:19Z 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://lev.thep.lu.se/trac/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 2 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 this program; if not, write to the Free Software
24  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25  02111-1307, USA.
26*/
27
28#include <string>
29
30#include <subversion-1/svn_client.h>
31
32namespace theplu {
33namespace svndigest {
34
35  class SVN;
36
37  ///
38  /// The SVNinfo class is a utility class for taking care of 'svn
39  /// info'.
40  ///
41  class SVNinfo {
42  public:
43
44    ///
45    /// Retrieve meta information about the item with \a path.
46    ///
47    /// @note The recursivness of the underlying subversion API is not
48    /// allowed (nor supported).
49    ///
50    explicit SVNinfo(const std::string& path);
51
52    ///
53    /// @brief Get the repository root URL.
54    ///
55    inline const std::string& repos_root_url(void) const
56    { return info_receiver_baton_.repos_root_url_; }
57
58    ///
59    /// @brief Get the URL.
60    ///
61    inline std::string url(void) const
62    { return info_receiver_baton_.url_; }
63
64    ///
65    /// @brief Get the author of the latest commit.
66    ///
67    inline const std::string& last_changed_author(void) const
68    { return info_receiver_baton_.last_changed_author_; }
69
70    ///
71    /// @brief Get the revision of the latest commit.
72    ///
73    inline svn_revnum_t last_changed_rev(void) const
74    { return info_receiver_baton_.last_changed_rev_; }
75
76    ///
77    /// @brief Get the current revision of the item.
78    ///
79    inline svn_revnum_t rev(void) const { return info_receiver_baton_.rev_; }
80
81
82  private:
83
84    ///
85    /// @brief Copy Constructor, not implemented.
86    ///
87    SVNinfo(const SVNinfo&);
88
89    ///
90    /// svn info is stored in the info_receiver_baton_. The
91    /// information is retrieved with the info_* set of member
92    /// functions. The struct is filled in the info_receiver function.
93    ///
94    /// @see info_receiver
95    ///
96    struct info_receiver_baton {
97      // more info is available but we only use these
98      std::string url_;
99      std::string repos_root_url_;
100      std::string last_changed_author_;
101      svn_revnum_t last_changed_rev_;
102      svn_revnum_t rev_;
103    } info_receiver_baton_ ;
104
105    ///
106    /// info_receiver is the function passed to the underlying
107    /// subversion API. This function is called by the subversion API
108    /// for every item matched by the conditions of the API call.
109    ///
110    /// @see Subversion API documentation
111    ///
112    // The return type should be svn_log_message_receiver_t but I
113    // cannot get it to compile (see comment for log_message_receiver
114    // in SVNlog.h)
115    static svn_error_t * info_receiver(void *baton, const char *path,
116                                       const svn_info_t *info, apr_pool_t *pool);
117  };
118
119}} // end of namespace svndigest and namespace theplu
120
121#endif
Note: See TracBrowser for help on using the repository browser.