#include "wx/defs.h"
#include "wx/list.h"
#include "wx/utils.h"
+#include <wx/intl.h>
#endif
// Sun CC compatibility (interference with xview/pkg.h, apparently...)
previous = last_one;
next = next_one;
list = the_list;
- key.string = NULL;
+ key.string = (char *) NULL;
if (previous)
previous->next = this;
wxList::wxList (void)
{
- first_node = NULL;
- last_node = NULL;
+ first_node = (wxNode *) NULL;
+ last_node = (wxNode *) NULL;
n = 0;
destroy_data = 0;
key_type = wxKEY_NONE;
wxList::wxList (int N, wxObject * Objects[])
{
- wxNode *last = NULL;
+ wxNode *last = (wxNode *) NULL;
int i;
for (i = 0; i < N; i++)
{
- wxNode *next = new wxNode (this, last, NULL, Objects[i]);
+ wxNode *next = new wxNode (this, last, (wxNode *) NULL, Objects[i]);
last = next;
if (i == 0)
first_node = next;
{
n = 0;
destroy_data = 0;
- first_node = NULL;
- last_node = NULL;
+ first_node = (wxNode *) NULL;
+ last_node = (wxNode *) NULL;
key_type = the_key_type;
}
va_start (ap, first_one);
- wxNode *last = new wxNode (this, NULL, NULL, first_one);
+ wxNode *last = new wxNode (this, (wxNode *) NULL, (wxNode *) NULL, first_one);
first_node = last;
n = 1;
break;
else
{
- wxNode *node = new wxNode (this, last, NULL, object);
+ wxNode *node = new wxNode (this, last, (wxNode *) NULL, object);
last = node;
n++;
}
wxNode *wxList::Append(wxObject *object)
{
- wxNode *node = new wxNode(this, last_node, NULL, object);
+ wxNode *node = new wxNode(this, last_node, (wxNode *) NULL, object);
if (!first_node)
first_node = node;
last_node = node;
if (j++ == i)
return current;
}
- return NULL; // No such element
+ return (wxNode *) NULL; // No such element
}
current = current->Next();
}
- return NULL; // Not found!
+ return (wxNode *) NULL; // Not found!
}
wxNode *wxList::Find (const char *key) const
{
if (!current->key.string)
{
- wxFatalError ("wxList: string key not present, probably did not Append correctly!");
+ wxFatalError (_("wxList: string key not present, probably did not Append correctly!"));
break;
}
if (strcmp (current->key.string, key) == 0)
current = current->Next();
}
- return NULL; // Not found!
+ return (wxNode *) NULL; // Not found!
}
if (each == object)
return current;
}
- return NULL;
+ return (wxNode *) NULL;
}
bool wxList::DeleteNode (wxNode * node)
// Insert new node at front of list
wxNode *wxList::Insert (wxObject * object)
{
- wxNode *node = new wxNode (this, NULL, First (), object);
+ wxNode *node = new wxNode (this, (wxNode *) NULL, First (), object);
first_node = node;
if (!(node->Next ()))
// Insert new node before given node.
wxNode *wxList::Insert (wxNode * position, wxObject * object)
{
- wxNode *prev = NULL;
+ wxNode *prev = (wxNode *) NULL;
if (position)
prev = position->Previous ();
// Keyed append
wxNode *wxList::Append (long key, wxObject * object)
{
- wxNode *node = new wxNode (this, last_node, NULL, object, key);
+ wxNode *node = new wxNode (this, last_node, (wxNode *) NULL, object, key);
if (!first_node)
first_node = node;
last_node = node;
wxNode *wxList::Append (const char *key, wxObject * object)
{
- wxNode *node = new wxNode (this, last_node, NULL, object, key);
+ wxNode *node = new wxNode (this, last_node, (wxNode *) NULL, object, key);
if (!first_node)
first_node = node;
last_node = node;
delete current;
current = next;
}
- first_node = NULL;
- last_node = NULL;
+ first_node = (wxNode *) NULL;
+ last_node = (wxNode *) NULL;
n = 0;
}
{ if ((*F)( each->Data ())) return each->Data();
each = each->Next();
}
- return NULL;
+ return (wxNode *) NULL;
}
// Like FirstThat, but proceeds from the end backward
wxObject *wxList::LastThat(wxListIterateFunction F)
{ if ((*F)( each->Data ())) return each->Data();
each = each->Previous();
}
- return NULL;
+ return (wxNode *) NULL;
}
// (stefan.hammes@urz.uni-heidelberg.de)
{
}
+wxStringList::wxStringList (const wxStringList& list)
+{
+ (*this) = list;
+}
+
// Variable argument list, terminated by a zero
// Makes new storage for the strings
wxStringList::wxStringList (const char *first...)
n = 0;
destroy_data = 0;
key_type = wxKEY_NONE;
- first_node = NULL;
- last_node = NULL;
+ first_node = (wxNode *) NULL;
+ last_node = (wxNode *) NULL;
if (!first)
return;
va_start (ap, first);
- wxNode *last = new wxNode (this, NULL, NULL, (wxObject *) copystring (first));
+ wxNode *last = new wxNode (this, (wxNode *) NULL, (wxNode *) NULL, (wxObject *) copystring (first));
first_node = last;
n = 1;
break;
else
{
- wxNode *node = new wxNode (this, last, NULL, (wxObject *) copystring (s));
+ wxNode *node = new wxNode (this, last, (wxNode *) NULL, (wxObject *) copystring (s));
last = node;
n++;
}
wxStringList::~wxStringList (void)
{
- wxNode *each = first_node;
+ Clear();
+}
+
+void wxStringList::Clear(void)
+{
+ wxNode *each = First();
while (each)
{
char *s = (char *) each->Data ();
delete each;
each = next;
}
+ wxList::Clear();
}
wxNode *wxStringList::Add (const char *s)
}
return FALSE;
}
+
+void wxStringList::operator= (const wxStringList& list)
+{
+ Clear();
+
+ wxNode *node = list.First();
+ while (node)
+ {
+ char *s = (char *) node->Data ();
+ Add(s);
+ node = node->Next();
+ }
+}
+
+char* wxStringList::operator[] (int i) const
+{
+ wxASSERT_MSG( (i < Number()), "Invalid index for wxStringList" );
+
+ return (char*) (Nth(i)->Data());
+}
+