libsaria: Begin a custom List class
I'm going to gradually replace the stl list with my own implementation. This should make everything more efficient and I won't have to deal with those pesky iterators. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
14fe5661a5
commit
4aac603b85
|
@ -2,6 +2,8 @@
|
|||
#define LIBSARIA_LIBRARY_H
|
||||
|
||||
#include <libsaria/fs.h>
|
||||
#include <libsaria/list.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/playlist.h>
|
||||
|
||||
#include <string>
|
||||
|
@ -10,8 +12,6 @@ using namespace std;
|
|||
namespace libsaria
|
||||
{
|
||||
|
||||
class Track;
|
||||
|
||||
namespace library
|
||||
{
|
||||
|
||||
|
@ -22,6 +22,7 @@ namespace libsaria
|
|||
unsigned int next_track;
|
||||
string path;
|
||||
list<Track> tracks;
|
||||
List<Track> _tracks;
|
||||
};
|
||||
|
||||
class Driver {
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef LIBSARIA_LIST_H
|
||||
#define LIBSARIA_LIST_H
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
template <class T>
|
||||
class List;
|
||||
|
||||
template <class T>
|
||||
class ListNode {
|
||||
private:
|
||||
ListNode *prev;
|
||||
ListNode *next;
|
||||
List<T> *list;
|
||||
T value;
|
||||
|
||||
public:
|
||||
ListNode();
|
||||
ListNode(T, List<T> *);
|
||||
~ListNode();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class List {
|
||||
private:
|
||||
ListNode<T> head;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#include "../../libsaria/list/node.cpp"
|
||||
|
||||
#endif /* LIBSARIA_LIST_H */
|
|
@ -1,12 +1,18 @@
|
|||
#ifndef LIBSARIA_TRACK_H
|
||||
#define LIBSARIA_TRACK_H
|
||||
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/playlist.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
namespace library
|
||||
{
|
||||
class Path;
|
||||
}
|
||||
|
||||
class Track
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker.
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/ban.h>
|
||||
|
||||
static libsaria::Set banned_plist("Banned", PL_STATIC | PL_NO_DRAIN);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker.
|
||||
#ifndef LIBSARIA_NODE_CPP
|
||||
#define LIBSARIA_NODE_CPP
|
||||
|
||||
#include <libsaria/list.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
template <class T>
|
||||
ListNode<T>::ListNode()
|
||||
{
|
||||
prev = NULL;
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
ListNode<T>::ListNode(T val, List<T> *lst)
|
||||
{
|
||||
prev = NULL;
|
||||
next = NULL;
|
||||
list = lst;
|
||||
value = val;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
ListNode<T>::~ListNode()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* LIBSARIA_NODE_CPP */
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker.
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/audio.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/print.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) 2012 Bryan Schumaker.
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/print.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker.
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/track.h>
|
||||
|
||||
#include <sstream>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker.
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/ban.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker.
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/format.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/audio.h>
|
||||
|
|
Loading…
Reference in New Issue