File: wvstringlist.cc

package info (click to toggle)
wvstreams 4.6.1-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,420 kB
  • sloc: cpp: 64,196; ansic: 4,154; sh: 4,025; makefile: 546; perl: 402
file content (71 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * Worldvisions Weaver Software:
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
 *
 * Some helper functions for WvStringList.
 * 
 * This is blatantly block-copied from WvStringTable, but I don't care!  Hah!
 * (I just know I'm going to regret this someday...)
 */
#include "wvstringlist.h"
#include "strutils.h"


WvString WvStringList::join(const char *joinchars) const
{
    return ::strcoll_join(*this, joinchars);
}

void WvStringList::split(WvStringParm s, const char *splitchars,
    int limit)
{
    return ::strcoll_split(*this, s, splitchars, limit);
}

void WvStringList::splitstrict(WvStringParm s, const char *splitchars,
    int limit)
{
    return ::strcoll_splitstrict(*this, s, splitchars, limit);
}

void WvStringList::fill(const char * const *array)
{
    while (array && *array)
    {
	append(new WvString(*array), true);
	array++;
    }
}


void WvStringList::append(WvStringParm str)
{
    WvStringListBase::append(new WvString(str), true);
}


void WvStringList::append(WvString *strp, bool autofree, char *id)
{
    WvStringListBase::append(strp, autofree, id);
}


// get the first string in the list, or an empty string if the list is empty.
// Removes the returned string from the list.
WvString WvStringList::popstr()
{
    if (isempty())
	return "";
    
    WvString s = *first();
    unlink_first();
    return s;
}


#ifndef _WIN32
void WvStringList::split(WvStringParm s, const WvRegex &regex, int limit)
{
    return ::strcoll_split(*this, s, regex, limit);
}
#endif