Subversion Repositories spk

Rev

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