ocarina/include/list.h
Bryan Schumaker 258875bdb8 libsaria: Move header files out of include/libsaria/
Ocarina no longer has a header file subdirectory so there is no reason
to have a libsaria subdirectory anymore.  Putting header files directly
in the include/ directory is a bit simpler.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
2012-09-12 08:15:31 -04:00

58 lines
971 B
C++

#ifndef LIBSARIA_LIST_H
#define LIBSARIA_LIST_H
namespace libsaria
{
template <class T>
class List;
template <class T>
class ListItem {
friend class List<T>;
private:
ListItem *prev_item;
ListItem *next_item;
List<T> *list;
T value;
public:
ListItem();
ListItem(T, List<T> *, ListItem<T> *, ListItem<T> *);
~ListItem();
T &get_value();
ListItem<T> *next();
};
template <class T>
class List {
private:
unsigned int count;
ListItem<T> head;
public:
List();
List(const List<T> &);
~List();
ListItem<T> *push_front(T);
ListItem<T> *push_back(T);
T pop_front();
ListItem<T> *erase(ListItem<T> *);
unsigned int size();
ListItem<T> *first();
ListItem<T> *end();
void for_each_item(void (*)(T &, void *), void *);
ListItem<T> *find_item(bool (*)(T &, void *), void *);
};
};
#include "../libsaria/list/node.cpp"
#include "../libsaria/list/list.cpp"
#endif /* LIBSARIA_LIST_H */