1 /** 2 * Yudit Unicode Editor Source File 3 * 4 * GNU Copyright (C) 1997-2006 Gaspar Sinai <gaspar@yudit.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License, version 2, 8 * dated June 1991. See file COPYYING for details. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 #ifndef SStringVector_h 21 #define SStringVector_h 22 23 #include "SString.h" 24 #include "SVector.h" 25 26 #include <string.h> 27 28 /** 29 * We make the SBinVector private so that nobody can screw with 30 * The autodelete. 31 */ 32 class SStringVector : public SVector<SString> 33 { 34 public: 35 SStringVector (void); 36 SStringVector (const SStringVector& base); 37 SStringVector (const SString& base); 38 SStringVector (const char* base); 39 SStringVector (const SString& base, const SString& delim, bool once=false); 40 virtual SObject* clone() const; 41 virtual ~SStringVector (); 42 /* Split a sting and add it to the list */ 43 unsigned int split (const SString& s, const SString& delimiters, bool once=false); 44 void sort(bool ascending=true); 45 /* splits and leave \" marked text untact */ 46 unsigned int smartSplit (const SString& s); 47 int trim(SString* in) const; 48 SString join(const SString& delimiter) const; 49 void append (const SStringVector& v); 50 void append (const SString& str); 51 void append (const char* str); 52 private: 53 void sort(unsigned int* indeces, bool ascending, int left, int right); 54 int compare (unsigned int* indeces, int i1, int i2); 55 }; 56 57 #endif /* SStringVector _h*/ 58