File indexing completed on 2024-05-12 17:16:25
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_TARGETS_H 0033 #define SVNQT_TARGETS_H 0034 0035 #include <svnqt/svnqt_defines.h> 0036 #include <svnqt/svnqttypes.h> 0037 0038 // apr api 0039 #include <apr_tables.h> 0040 0041 #include <QList> 0042 0043 class QStringList; 0044 class QUrl; 0045 0046 namespace svn 0047 { 0048 // forward declarations 0049 class Pool; 0050 0051 /** 0052 * Encapsulation for Subversion target arrays handling 0053 */ 0054 class SVNQT_EXPORT Targets 0055 { 0056 public: 0057 /** 0058 * Constructor 0059 * 0060 * @param targets vector of paths 0061 */ 0062 explicit Targets(const svn::Paths &targets); 0063 0064 /** 0065 * Constructor 0066 * @param path a single paths 0067 */ 0068 Targets(const svn::Path &target); //krazy:exclude=explicit 0069 0070 /** 0071 * Constructor. Initializes list with just 0072 * one entry 0073 * 0074 * @param target 0075 */ 0076 Targets(const QString &target = QString()); //krazy:exclude=explicit 0077 0078 /** 0079 * Returns an apr array containing 0080 * char *. 0081 * 0082 * @param pool Pool used for conversion 0083 */ 0084 apr_array_header_t * 0085 array(const Pool &pool) const; 0086 0087 /** 0088 * Returns a vector of paths 0089 * 0090 * @return vector of paths 0091 */ 0092 const Paths &targets() const 0093 { 0094 return m_targets; 0095 } 0096 0097 /** 0098 * @return the number of targets 0099 */ 0100 Paths::size_type size() const 0101 { 0102 return m_targets.size(); 0103 } 0104 0105 /** 0106 * operator to return the vector 0107 * 0108 * @return vector with targets 0109 */ 0110 operator const Paths &() const 0111 { 0112 return m_targets; 0113 } 0114 0115 const Path &operator [](Paths::size_type which) const 0116 { 0117 return m_targets.at(which); 0118 } 0119 /** 0120 * returns one single target. 0121 * the first in the vector, if no parameter given if there are more 0122 * than one. if there is no target or parameter > then stored pathes returns 0123 * an empty path 0124 * \param which which item we want 0125 * @return single path 0126 */ 0127 const Path 0128 target(Paths::size_type which) const; 0129 0130 /** convenience functions 0131 */ 0132 static Targets fromStringList(const QStringList &paths); 0133 enum class UrlConversion 0134 { 0135 KeepUrl, 0136 PreferLocalPath 0137 }; 0138 0139 static Targets fromUrlList(const QList<QUrl> &urls, UrlConversion conversion); 0140 0141 private: 0142 Paths m_targets; 0143 }; 0144 } 0145 0146 #endif 0147 /* ----------------------------------------------------------------- 0148 * local variables: 0149 * eval: (load-file "../../rapidsvn-dev.el") 0150 * end: 0151 */