Rev 98 | Rev 112 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#include "StringList.h"
#include "spkdef.h"
namespace Utils {
void CStringList::pushBack(const String &str, const String &data)
{
SStringList *strNode = new SStringList;
strNode->str = str;
strNode->data = data;
this->push_back(strNode);
}
void CStringList::clear()
{
this->destroy(true);
}
void CStringList::tokenise(const String &str, const String &token)
{
int max = 0;
Utils::String *strs = str.tokenise(token, &max);
for ( int i = 0; i < max; i++ ) {
this->pushBack(strs[i], Utils::String::Null());
}
CLEANSPLIT(strs, max);
}
Utils::String CStringList::firstString()
{
SStringList *node = this->First();
if ( node ) return node->str;
return Utils::String::Null();
}
Utils::String CStringList::nextString()
{
SStringList *node = this->Next();
if ( node ) return node->str;
return Utils::String::Null();
}
Utils::String CStringList::findData(const Utils::String &data, bool bIgnoreCase) const
{
for(CListNode<SStringList> *node = this->Front(); node; node = node->next()) {
if ( node->Data()->data.Compare(data, !bIgnoreCase) )
return node->Data()->str;
}
return String::Null();
}
Utils::String CStringList::findString(const Utils::String &str, bool bIgnoreCase) const
{
for(CListNode<SStringList> *node = this->Front(); node; node = node->next()) {
if ( node->Data()->str.Compare(str, !bIgnoreCase) )
return node->Data()->data;
}
return String::Null();
}
}
/*
StringList::StringList(void)
{
}
StringList::~StringList(void)
{
}
*/