aboutsummaryrefslogtreecommitdiff
path: root/src/ClientList.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-16 22:55:33 +0100
committerMax Kellermann <max@duempel.org>2013-01-16 23:00:13 +0100
commit601495fa0f3d3793d4ee761d1b86f8435417266c (patch)
tree1284f0f0ac48668391063e5f45eba08d0b59c2ed /src/ClientList.hxx
parent1998633739b027b97ff89f92825512db91dca8f9 (diff)
ClientList: convert to a class
Diffstat (limited to 'src/ClientList.hxx')
-rw-r--r--src/ClientList.hxx41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/ClientList.hxx b/src/ClientList.hxx
index a5a89cee..e8560af7 100644
--- a/src/ClientList.hxx
+++ b/src/ClientList.hxx
@@ -20,21 +20,42 @@
#ifndef MPD_CLIENT_LIST_HXX
#define MPD_CLIENT_LIST_HXX
+#include <list>
+
class Client;
-bool
-client_list_is_full(void);
+class ClientList {
+ const unsigned max_size;
+
+ unsigned size;
+ std::list<Client *> list;
+
+public:
+ ClientList(unsigned _max_size)
+ :max_size(_max_size), size(0) {}
+
+ std::list<Client *>::iterator begin() {
+ return list.begin();
+ }
+
+ std::list<Client *>::iterator end() {
+ return list.end();
+ }
+
+ bool IsFull() const {
+ return size >= max_size;
+ }
-void
-client_list_add(Client *client);
+ void Add(Client &client) {
+ list.push_front(&client);
+ ++size;
+ }
-void
-client_list_foreach(void (*callback)(Client *client, void *ctx), void *ctx);
+ void Remove(Client &client);
-void
-client_list_remove(Client *client);
+ void CloseAll();
-void
-client_list_close_all();
+ void IdleAdd(unsigned flags);
+};
#endif