File indexing completed on 2024-05-12 17:16:24
0001 /* 0002 * Port for usage with qt-framework and development for kdesvn 0003 * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) 0004 * http://kdesvn.alwins-world.de 0005 */ 0006 /* 0007 * ==================================================================== 0008 * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. 0009 * dev@rapidsvn.tigris.org 0010 * 0011 * This library is free software; you can redistribute it and/or 0012 * modify it under the terms of the GNU Lesser General Public 0013 * License as published by the Free Software Foundation; either 0014 * version 2.1 of the License, or (at your option) any later version. 0015 * 0016 * This library is distributed in the hope that it will be useful, 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0019 * Lesser General Public License for more details. 0020 * 0021 * You should have received a copy of the GNU Lesser General Public 0022 * License along with this library (in the file LGPL.txt); if not, 0023 * write to the Free Software Foundation, Inc., 51 Franklin St, 0024 * Fifth Floor, Boston, MA 02110-1301 USA 0025 * 0026 * This software consists of voluntary contributions made by many 0027 * individuals. For exact contribution history, see the revision 0028 * history and logs, available at http://rapidsvn.tigris.org/. 0029 * ==================================================================== 0030 */ 0031 0032 #ifndef SVNQT_PATH_H 0033 #define SVNQT_PATH_H 0034 0035 #include <QString> 0036 #include <svnqt/svnqt_defines.h> 0037 #include <svnqt/svnqttypes.h> 0038 0039 namespace svn 0040 { 0041 /** 0042 * Encapsulation for Subversion Path handling 0043 */ 0044 class SVNQT_EXPORT Path 0045 { 0046 private: 0047 QString m_path; 0048 0049 /** 0050 * initialize the class 0051 * 0052 * @param path Path string - when url this should NOT hold revision as @ parameter!!!!! (will filtered out) 0053 */ 0054 void init(const QString &path); 0055 0056 public: 0057 /** 0058 * Constructor that takes a string as parameter. 0059 * The string is converted to subversion internal 0060 * representation. The string is copied. 0061 * 0062 * @param path Path string - when url this should NOT hold revision as @ parameter!!!!! (will filtered out) 0063 */ 0064 Path(const QString &path = QString()); //krazy:exclude=explicit 0065 0066 ~Path() = default; 0067 0068 /** 0069 * Assignment operator 0070 */ 0071 Path &operator=(const Path &); 0072 0073 /** 0074 * @return Path string 0075 */ 0076 const QString & 0077 path() const; 0078 0079 /** 0080 * @return Path string as c string 0081 */ 0082 const QByteArray cstr() const; 0083 0084 /** 0085 * check whether a path is set. Right now 0086 * this checks only if the string is non- 0087 * empty. 0088 * 0089 * @return true if there is a path set 0090 */ 0091 bool isSet() const; 0092 0093 /** 0094 * adds a new URL component to the path 0095 * 0096 * @param component new component to add 0097 */ 0098 void addComponent(const QString &component); 0099 0100 /** Reduce path to its parent folder. 0101 * If the path length is 1 (eg., only "/") it will cleared so 0102 * path length will get zero. 0103 * @sa svn_path_remove_component 0104 */ 0105 void removeLast(); 0106 0107 /** Parse a string for a peg revision 0108 * @param pathorurl url to parse 0109 * @param _path target to store the cleaned url 0110 * @param _peg target where to store the peg url. 0111 * @throw svn::ClientException on errors 0112 */ 0113 static void 0114 parsePeg(const QString &pathorurl, Path &_path, svn::Revision &_peg); 0115 0116 /** return the length of the path-string */ 0117 unsigned int 0118 length() const; 0119 0120 /** returns the path with native separators */ 0121 QString 0122 native() const; 0123 0124 /** returns if the path is a valid url, eg. points to a remote */ 0125 bool isUrl()const; 0126 }; 0127 } 0128 0129 #endif 0130 /* ----------------------------------------------------------------- 0131 * local variables: 0132 * eval: (load-file "../../rapidsvn-dev.el") 0133 * end: 0134 */