SvnCpp
path.hpp
Go to the documentation of this file.
1 /*
2  * ====================================================================
3  * Copyright (c) 2002-2009 The RapidSvn Group. All rights reserved.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program (in the file GPL.txt.
17  * If not, see <http://www.gnu.org/licenses/>.
18  *
19  * This software consists of voluntary contributions made by many
20  * individuals. For exact contribution history, see the revision
21  * history and logs, available at http://rapidsvn.tigris.org/.
22  * ====================================================================
23  */
24 
25 #ifndef _SVNCPP_PATH_HPP_
26 #define _SVNCPP_PATH_HPP_
27 
28 // stl
31 
32 namespace svn
33 {
37  class Path
38  {
39  private:
40  std::string m_path;
41  bool m_pathIsUrl;
42 
48  void init(const char * path);
49 
50  public:
58  Path(const std::string & path = "");
59 
66  Path(const char * path);
67 
73  Path(const Path & path);
74 
78  Path& operator= (const Path&);
79 
83  bool
84  operator== (const Path&) const;
85 
89  const std::string &
90  path() const;
91 
95  const char *
96  c_str() const;
97 
110  bool
111  isSet() const;
112 
118  bool
119  isUrl() const;
120 
126  void
127  addComponent(const char * component);
128 
134  void
135  addComponent(const std::string & component);
136 
143  void
144  split(std::string & dirpath, std::string & basename) const;
145 
154  void
155  split(std::string & dir, std::string & filename, std::string & ext) const;
156 
162  std::string
163  basename() const;
164 
170  std::string
171  dirpath() const;
172 
179  std::string
180  substr(const size_t index) const;
181 
187  std::string
188  unescape() const;
189 
193  static Path
194  getTempDir();
195 
197  size_t
198  length() const;
199 
201  std::string
202  native() const;
203  };
204 
205  typedef std::vector<Path> PathVector;
206 
207  extern const PathVector EmptyPathVector;
208 }
209 
210 #endif
211 /* -----------------------------------------------------------------
212  * local variables:
213  * eval: (load-file "../../rapidsvn-dev.el")
214  * end:
215  */