Subversion Repositories spk

Rev

Rev 101 | Rev 112 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8 cycrow 1
 
2
#include "StringList.h"
98 cycrow 3
#include "spkdef.h"
8 cycrow 4
 
5
namespace Utils {
6
	void CStringList::pushBack(const String &str, const String &data)
7
	{
8
		SStringList *strNode = new SStringList;
9
		strNode->str = str;
10
		strNode->data = data;
11
		this->push_back(strNode);
12
	}
111 cycrow 13
	void CStringList::pushBack(const String &str)
14
	{
15
		pushBack(str, "");
16
	}
9 cycrow 17
 
18
	void CStringList::clear()
19
	{
20
		this->destroy(true);
21
	}
98 cycrow 22
 
23
	void CStringList::tokenise(const String &str, const String &token)
24
	{
25
		int max = 0;
26
		Utils::String *strs = str.tokenise(token, &max);
27
		for ( int i = 0; i < max; i++ ) {
28
			this->pushBack(strs[i], Utils::String::Null());
29
		}
30
 
31
		CLEANSPLIT(strs, max);
32
	}
33
 
34
	Utils::String CStringList::firstString()
35
	{
36
		SStringList *node = this->First();
37
		if ( node ) return node->str;
38
		return Utils::String::Null();
39
	}
40
 
41
	Utils::String CStringList::nextString()
42
	{
43
		SStringList *node = this->Next();
44
		if ( node ) return node->str;
45
		return Utils::String::Null();
46
	}
101 cycrow 47
 
48
	Utils::String CStringList::findData(const Utils::String &data, bool bIgnoreCase) const
49
	{
50
		for(CListNode<SStringList> *node = this->Front(); node; node = node->next()) {
51
			if ( node->Data()->data.Compare(data, !bIgnoreCase) )
52
				return node->Data()->str;
53
		}
54
 
55
		return String::Null();
56
	}
57
 
58
	Utils::String CStringList::findString(const Utils::String &str, bool bIgnoreCase) const
59
	{
60
		for(CListNode<SStringList> *node = this->Front(); node; node = node->next()) {
61
			if ( node->Data()->str.Compare(str, !bIgnoreCase) )
62
				return node->Data()->data;
63
		}
64
 
65
		return String::Null();
66
	}
8 cycrow 67
}
68
/*
69
StringList::StringList(void)
70
{
71
}
72
 
73
StringList::~StringList(void)
74
{
75
}
76
*/