Make WvStreams compile with gcc 4.4.
[wvstreams.git] / utils / wvstringlist.cc
blobf67fb5361211bdbdc9750b1503d10d4f5505ad9f
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * Some helper functions for WvStringList.
6 *
7 * This is blatantly block-copied from WvStringTable, but I don't care! Hah!
8 * (I just know I'm going to regret this someday...)
9 */
10 #include "wvstringlist.h"
11 #include "strutils.h"
14 WvString WvStringList::join(const char *joinchars) const
16 return ::strcoll_join(*this, joinchars);
19 void WvStringList::split(WvStringParm s, const char *splitchars,
20 int limit)
22 return ::strcoll_split(*this, s, splitchars, limit);
25 void WvStringList::splitstrict(WvStringParm s, const char *splitchars,
26 int limit)
28 return ::strcoll_splitstrict(*this, s, splitchars, limit);
31 void WvStringList::fill(const char * const *array)
33 while (array && *array)
35 append(new WvString(*array), true);
36 array++;
41 void WvStringList::append(WvStringParm str)
43 WvStringListBase::append(new WvString(str), true);
47 void WvStringList::append(WvString *strp, bool autofree, char *id)
49 WvStringListBase::append(strp, autofree, id);
53 // get the first string in the list, or an empty string if the list is empty.
54 // Removes the returned string from the list.
55 WvString WvStringList::popstr()
57 if (isempty())
58 return "";
60 WvString s = *first();
61 unlink_first();
62 return s;
66 #ifndef _WIN32
67 void WvStringList::split(WvStringParm s, const WvRegex &regex, int limit)
69 return ::strcoll_split(*this, s, regex, limit);
71 #endif