PARP Research Group | Universidad de Murcia |
src/qvblockprogramming/qvguiblocks/qvindexedstringlist.hGo to the documentation of this file.00001 /* 00002 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012. PARP Research Group. 00003 * <http://perception.inf.um.es> 00004 * University of Murcia, Spain. 00005 * 00006 * This file is part of the QVision library. 00007 * 00008 * QVision is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as 00010 * published by the Free Software Foundation, version 3 of the License. 00011 * 00012 * QVision is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with QVision. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00024 00025 #ifndef QVINDEXEDSTRINGLIST_H 00026 #define QVINDEXEDSTRINGLIST_H 00027 00028 #include <QStringList> 00029 #include <QMetaType> 00030 00041 class QVIndexedStringList: public QStringList 00042 { 00043 private: 00044 int index; 00045 00046 public: 00050 QVIndexedStringList() : QStringList(), index(-1) { } 00051 00054 QVIndexedStringList( const QVIndexedStringList& l ) : QStringList(l), index(l.index) { } 00055 00059 QVIndexedStringList( const QStringList& l ) : QStringList(l), index(l.isEmpty()? -1 : 0) { } 00060 00064 QVIndexedStringList( const QString& i ) { append(i); index = 0; } 00065 00066 #ifndef DOXYGEN_IGNORE_THIS 00067 //redefiniciones (los que devuelven listas y los que cambian ordenes) 00068 // quedan algunos métodos heredados que modifican la lista: erase, insert, removeAll, removeFirst, removeLast, Swap 00069 void sort(); 00070 QVIndexedStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; 00071 #ifndef QT_NO_REGEXP 00072 QVIndexedStringList filter(const QRegExp &rx) const; 00073 #endif 00074 QVIndexedStringList operator+(const QVIndexedStringList &other) const; 00075 #endif 00076 00079 int getIndex() const { return index; } 00080 00083 QString getCurrent() const; 00084 00092 bool setIndex(int i); 00093 00099 bool incIndex(); 00100 00106 bool decIndex(); 00107 00111 void append(const QString &str); 00112 }; 00113 00114 Q_DECLARE_METATYPE(QVIndexedStringList); 00115 #endif 00116 |