source: trunk/lib/SVNinfo.h @ 129

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

Addresses ticket:23. Changed usage of 'svn info' to API calls.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1// $Id: SVNinfo.h 129 2006-08-02 17:56:18Z jari $
2
3/*
4  Copyright (C) 2006 Jari Häkkinen
5
6  This file is part of svnstat, http://lev.thep.lu.se/trac/svnstat
7
8  svnstat 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  svnstat 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_svnstat_svninfo_
25#define _theplu_svnstat_svninfo_
26
27#include <string>
28
29#include <svn_client.h>
30
31namespace theplu {
32namespace svnstat {
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    std::string const
55    repos_root_url(void) { return info_receiver_baton_.info->repos_root_URL; }
56
57    ///
58    /// @brief Get the author of the latest commit.
59    ///
60    std::string last_changed_author(void) const
61    { return info_receiver_baton_.info->last_changed_author; }
62
63    ///
64    /// @brief Get the revision of the latest commit.
65    ///
66    svn_revnum_t last_changed_rev(void) const
67    { return info_receiver_baton_.info->last_changed_rev; }
68
69    ///
70    /// @brief Get the current revision of the item.
71    ///
72    svn_revnum_t rev(void) const
73    { return info_receiver_baton_.info->rev; }
74
75
76  private:
77
78    ///
79    /// @brief Copy Constructor, not implemented.
80    ///
81    SVNinfo(const SVNinfo&);
82
83    SVN* instance_;
84
85    ///
86    /// svn info is stored in the info_receiver_baton_. The
87    /// information is retrieved with the info_* set of member
88    /// functions. The struct is filled in the info_receiver function.
89    ///
90    /// @see info_receiver
91    ///
92    struct info_receiver_baton_ {
93      svn_info_t *info;
94    } info_receiver_baton_ ;
95
96    ///
97    /// info_receiver is the function passed to the underlying
98    /// subversion API. This function is called by the subversion API
99    /// for every item matched by the conditions of the API call.
100    ///
101    /// @see Subversion API documentation
102    ///
103    static svn_error_t * info_receiver(void *baton, const char *path,
104                                       const svn_info_t *info, apr_pool_t *pool);
105  };
106
107}} // end of namespace svnstat and namespace theplu
108
109#endif
Note: See TracBrowser for help on using the repository browser.