WvStreams
wvstringlist.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * WvStrings are used a lot more often than WvStringLists, so the List need
00006  * not be defined most of the time.  Include this file if you need it.
00007  *
00008  */
00009 #ifndef __WVSTRINGLIST_H
00010 #define __WVSTRINGLIST_H
00011 
00012 #include "wvstring.h"
00013 #include "wvlinklist.h"
00014 
00015 class WvRegex;
00016 
00017 DeclareWvList2(WvStringListBase, WvString);
00018 
00027 class WvStringList : public WvStringListBase
00028 {
00029     // copy constructor: not defined anywhere!
00030     WvStringList(const WvStringList &l);
00031 public:
00035     WvStringList() {}
00036     
00040     WvString join(const char *joinchars = " ") const;
00041     
00051     void split(WvStringParm s, const char *splitchars = " \t\r\n",
00052                int limit = 0);
00066     void splitstrict(WvStringParm s, const char *splitchars = " \t\r\n",
00067                int limit = 0);
00068 
00069 #ifndef _WIN32
00070 
00075     void split(WvStringParm s, const WvRegex &regex, int limit = 0);
00076 #endif
00077     
00078     /*
00079      * populate the list from an array of strings
00080      */
00081     void fill(const char * const *array);
00082 
00083     void append(WvStringParm str);
00084     void append(WVSTRING_FORMAT_DECL)
00085         { append(WvString(WVSTRING_FORMAT_CALL)); }
00086     void append(WvString *strp, bool autofree, char *id = NULL);
00087 
00092     WvString popstr();
00093 };
00094 
00095 #endif // __WVSTRINGLIST_H