libDwm-0.9.45
DwmSvnTag.hh
Go to the documentation of this file.
1//===========================================================================
2// @(#) $DwmPath$
3//===========================================================================
4// Copyright (c) Daniel W. McRobb 2016
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions
9// are met:
10//
11// 1. Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13// 2. Redistributions in binary form must reproduce the above copyright
14// notice, this list of conditions and the following disclaimer in the
15// documentation and/or other materials provided with the distribution.
16// 3. The names of the authors and copyright holders may not be used to
17// endorse or promote products derived from this software without
18// specific prior written permission.
19//
20// IN NO EVENT SHALL DANIEL W. MCROBB BE LIABLE TO ANY PARTY FOR
21// DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
22// INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE,
23// EVEN IF DANIEL W. MCROBB HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
24// DAMAGE.
25//
26// THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND
27// DANIEL W. MCROBB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
28// UPDATES, ENHANCEMENTS, OR MODIFICATIONS. DANIEL W. MCROBB MAKES NO
29// REPRESENTATIONS AND EXTENDS NO WARRANTIES OF ANY KIND, EITHER
30// IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31// WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
32// OR THAT THE USE OF THIS SOFTWARE WILL NOT INFRINGE ANY PATENT,
33// TRADEMARK OR OTHER RIGHTS.
34//===========================================================================
35
36//---------------------------------------------------------------------------
39//---------------------------------------------------------------------------
40
41#ifndef _DWMSVNTAG_HH_
42#define _DWMSVNTAG_HH_
43
44#include <string>
45
46namespace Dwm {
47
48 //--------------------------------------------------------------------------
51 //--------------------------------------------------------------------------
52 class SvnTag
53 {
54 public:
55 //------------------------------------------------------------------------
58 //------------------------------------------------------------------------
59 SvnTag(const std::string & keyword);
60
61 //------------------------------------------------------------------------
75 //------------------------------------------------------------------------
76 std::string
77 TagName(const std::string & tagRegex = R"(\/tags\/([^\/]+))",
78 const std::string & branchRegex = R"(\/branches\/([^\/]+))",
79 const std::string & trunkRegex = R"(\/(trunk)\/)") const;
80
81 //------------------------------------------------------------------------
84 //------------------------------------------------------------------------
85 std::string FileName() const;
86
87 private:
88 const std::string _keyword;
89
90 bool IsRemoteRepo(const std::string & url) const;
91 void RemoveRepoStart(std::string & path) const;
92 };
93
94} // namespace Dwm
95
96#endif // _DWMSVNTAG_HH_
97
98
99//---------------------------- emacs settings -----------------------------
100// Local Variables:
101// mode: C++
102// tab-width: 2
103// indent-tabs-mode: nil
104// c-basic-offset: 2
105// End:
106//-------------------------------------------------------------------------
Trivial class used to fetch an assumed SVN tag name from a repository path (in a Subversion keyword).
Definition DwmSvnTag.hh:53
std::string FileName() const
Returns the file name.
SvnTag(const std::string &keyword)
Construct from a Header keyword substitution or any custom keyword substition that includes P or u.
std::string TagName(const std::string &tagRegex=R"(\/tags\/([^\/]+))", const std::string &branchRegex=R"(\/branches\/([^\/]+))", const std::string &trunkRegex=R"(\/(trunk)\/)") const
Fetches the SVN tag name using a regular expression tagRegex.