SvnCpp
|
00001 /* 00002 * ==================================================================== 00003 * Copyright (c) 2002-2009 The RapidSvn Group. All rights reserved. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program (in the file GPL.txt. 00017 * If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * This software consists of voluntary contributions made by many 00020 * individuals. For exact contribution history, see the revision 00021 * history and logs, available at http://rapidsvn.tigris.org/. 00022 * ==================================================================== 00023 */ 00024 00025 #ifndef _SVNCPP_PATH_HPP_ 00026 #define _SVNCPP_PATH_HPP_ 00027 00028 // stl 00029 #include "svncpp/string_wrapper.hpp" 00030 #include "svncpp/vector_wrapper.hpp" 00031 00032 namespace svn 00033 { 00037 class Path 00038 { 00039 private: 00040 std::string m_path; 00041 bool m_pathIsUrl; 00042 00048 void init(const char * path); 00049 00050 public: 00058 Path(const std::string & path = ""); 00059 00066 Path(const char * path); 00067 00073 Path(const Path & path); 00074 00078 Path& operator= (const Path&); 00079 00083 bool 00084 operator== (const Path&) const; 00085 00089 const std::string & 00090 path() const; 00091 00095 const char * 00096 c_str() const; 00097 00110 bool 00111 isSet() const; 00112 00118 bool 00119 isUrl() const; 00120 00126 void 00127 addComponent(const char * component); 00128 00134 void 00135 addComponent(const std::string & component); 00136 00143 void 00144 split(std::string & dirpath, std::string & basename) const; 00145 00154 void 00155 split(std::string & dir, std::string & filename, std::string & ext) const; 00156 00162 std::string 00163 basename() const; 00164 00170 std::string 00171 dirpath() const; 00172 00179 std::string 00180 substr(const size_t index) const; 00181 00187 std::string 00188 unescape() const; 00189 00193 static Path 00194 getTempDir(); 00195 00197 size_t 00198 length() const; 00199 00201 std::string 00202 native() const; 00203 }; 00204 00205 typedef std::vector<Path> PathVector; 00206 00207 extern const PathVector EmptyPathVector; 00208 } 00209 00210 #endif 00211 /* ----------------------------------------------------------------- 00212 * local variables: 00213 * eval: (load-file "../../rapidsvn-dev.el") 00214 * end: 00215 */