source: trunk/lib/SVNinfo.h @ 163

Last change on this file since 163 was 149, checked in by Jari Häkkinen, 15 years ago

Changed svnstat to svndigest.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
1// $Id: SVNinfo.h 149 2006-08-12 09:11:46Z jari $
2
3/*
4  Copyright (C) 2006 Jari Häkkinen
5
6  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
22*/
23
24#ifndef _theplu_svndigest_svninfo_
25#define _theplu_svndigest_svninfo_
26
27#include <string>
28
29#include <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 author of the latest commit.
59    ///
60    inline const std::string& last_changed_author(void) const
61    { return info_receiver_baton_.last_changed_author_; }
62
63    ///
64    /// @brief Get the revision of the latest commit.
65    ///
66    inline svn_revnum_t last_changed_rev(void) const
67    { return info_receiver_baton_.last_changed_rev_; }
68
69    ///
70    /// @brief Get the current revision of the item.
71    ///
72    inline svn_revnum_t rev(void) const { return info_receiver_baton_.rev_; }
73
74
75  private:
76
77    ///
78    /// @brief Copy Constructor, not implemented.
79    ///
80    SVNinfo(const SVNinfo&);
81
82    SVN* instance_;
83
84    ///
85    /// svn info is stored in the info_receiver_baton_. The
86    /// information is retrieved with the info_* set of member
87    /// functions. The struct is filled in the info_receiver function.
88    ///
89    /// @see info_receiver
90    ///
91    struct info_receiver_baton {
92      // more info is available but we only use these
93      std::string repos_root_url_;
94      std::string last_changed_author_;
95      svn_revnum_t last_changed_rev_;
96      svn_revnum_t rev_;
97    } info_receiver_baton_ ;
98
99    ///
100    /// info_receiver is the function passed to the underlying
101    /// subversion API. This function is called by the subversion API
102    /// for every item matched by the conditions of the API call.
103    ///
104    /// @see Subversion API documentation
105    ///
106    static svn_error_t * info_receiver(void *baton, const char *path,
107                                       const svn_info_t *info, apr_pool_t *pool);
108  };
109
110}} // end of namespace svndigest and namespace theplu
111
112#endif
Note: See TracBrowser for help on using the repository browser.