File indexing completed on 2024-05-12 17:16:25
0001 /*************************************************************************** 0002 * Copyright (C) 2006-2009 by Rajko Albrecht * 0003 * ral@alwins-world.de * 0004 * * 0005 * This program is free software; you can redistribute it and/or * 0006 * modify it under the terms of the GNU Lesser General Public * 0007 * License as published by the Free Software Foundation; either * 0008 * version 2.1 of the License, or (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0013 * Lesser General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU Lesser General Public * 0016 * License along with this program (in the file LGPL.txt); if not, * 0017 * write to the Free Software Foundation, Inc., 51 Franklin St, * 0018 * Fifth Floor, Boston, MA 02110-1301 USA * 0019 * * 0020 * This software consists of voluntary contributions made by many * 0021 * individuals. For exact contribution history, see the revision * 0022 * history and logs, available at http://kdesvn.alwins-world.de. * 0023 ***************************************************************************/ 0024 0025 #ifndef STRING_ARRAY_H 0026 #define STRING_ARRAY_H 0027 0028 #include <svnqt/svnqt_defines.h> 0029 #include <svnqt/svnqttypes.h> 0030 0031 #include <QStringList> 0032 0033 // apr api 0034 #include <apr_tables.h> 0035 0036 namespace svn 0037 { 0038 // forward declarations 0039 class Pool; 0040 0041 /** Handle array of const char * in a c++ like way */ 0042 class SVNQT_EXPORT StringArray 0043 { 0044 protected: 0045 QStringList m_content; 0046 bool m_isNull; 0047 0048 public: 0049 StringArray(); 0050 explicit StringArray(const QStringList &); 0051 explicit StringArray(const apr_array_header_t *apr_targets); 0052 QStringList::size_type size()const; 0053 const QString &operator[](QStringList::size_type which)const; 0054 QString &operator[](QStringList::size_type which); 0055 /** 0056 * Returns an apr array containing char*. 0057 * 0058 * @param pool Pool used for conversion 0059 */ 0060 apr_array_header_t *array(const Pool &pool) const; 0061 /** content of array 0062 * @return const reference to data, may used for searches. 0063 */ 0064 const QStringList &data() const 0065 { 0066 return m_content; 0067 } 0068 0069 /** if array should return 0 instead of empty array */ 0070 bool isNull()const; 0071 void setNull(bool _n); 0072 }; 0073 } 0074 0075 #endif