aboutsummaryrefslogtreecommitdiff
path: root/src/ClientList.hxx
diff options
context:
space:
mode:
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