source: trunk/lib/SVNinfo.h @ 312

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

added URL to 'General Information' on first page (fixes #196). To do that in a smooth way, I added a new member variable in SVNinfo class.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1#ifndef _theplu_svndigest_svninfo_
2#define _theplu_svndigest_svninfo_
3
4// $Id: SVNinfo.h 312 2007-05-17 10:58:04Z peter $
5
6/*
7  Copyright (C) 2006 Jari Häkkinen
8
9  This file is part of svndigest, http://lev.thep.lu.se/trac/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 <string>
28
29#include <subversion-1/svn_client.h>
30
31namespace theplu {
32namespace svndigest {
33
34  class SVN;
35
36  ///
37  /// The SVNinfo class is a utility class for taking care of 'svn
38  /// info'.
39  ///
40  class SVNinfo {
41  public:
42
43    ///
44    /// Retrieve meta information about the item with \a path.
45    ///
46    /// @note The recursivness of the underlying subversion API is not
47    /// allowed (nor supported).
48    ///
49    explicit SVNinfo(const std::string& path);
50
51    ///
52    /// @brief Get the repository root URL.
53    ///
54    inline const std::string& repos_root_url(void) const
55    { return info_receiver_baton_.repos_root_url_; }
56
57    ///
58    /// @brief Get the URL.
59    ///
60    inline std::string url(void) const
61    { return info_receiver_baton_.url_; }
62
63    ///
64    /// @brief Get the author of the latest commit.
65    ///
66    inline const std::string& last_changed_author(void) const
67    { return info_receiver_baton_.last_changed_author_; }
68
69    ///
70    /// @brief Get the revision of the latest commit.
71    ///
72    inline svn_revnum_t last_changed_rev(void) const
73    { return info_receiver_baton_.last_changed_rev_; }
74
75    ///
76    /// @brief Get the current revision of the item.
77    ///
78    inline svn_revnum_t rev(void) const { return info_receiver_baton_.rev_; }
79
80
81  private:
82
83    ///
84    /// @brief Copy Constructor, not implemented.
85    ///
86    SVNinfo(const SVNinfo&);
87
88    SVN* instance_;
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    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.