/*
* StringList.h
* Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 1999.09.03 Added two add method to take a reference or pointer to String.
// 1999.09.04 Added two add method to take a feference or pointer to StringList.
// 2008/07/07 Modified Boolean to bool
#pragma once
#include <sol\LinkedList.h>
#include <sol\String.h>
namespace SOL {
class StringList :public LinkedList {
public:
StringList() { }
// 1999.09.03
public:
bool add(const String& string) {
return LinkedList::addLast(new String(string));
}
// 1999.09.03
public:
bool add(const String* string) {
return LinkedList::addLast(new String(string));
}
public:
bool add(const TCHAR* string) {
return LinkedList::addLast(new String(string));
}
public:
bool addLast(const TCHAR* string) {
return LinkedList::addLast(new String(string));
}
public:
bool addFirst(const TCHAR* string) {
return LinkedList::addFirst(new String(string));
}
// 1999.09.04
//bool add(const StringList& list);
// 1999.09.04
//bool add(const StringList* list);
public:
bool add(const StringList& list)
{
bool rc = true;
if (list.getLength() > 0) {
ListEntry* p = list.getEntry();
while (p != NULL) {
String* string = (String*)p -> getObject();
if (string) {
add(string);
}
p = p -> getNext();
}
}
return rc;
}
public:
bool add(const StringList* list)
{
bool rc = true;
if (list != NULL && list -> getLength() > 0) {
ListEntry* p = list -> getEntry();
while (p != NULL) {
String* string = (String*)p -> getObject();
if (string) {
add(string);
}
p = p -> getNext();
}
}
return rc;
}
public:
String* getNth(int n) {
return (String*)LinkedList::getNth(n);
}
};
}
|