aboutsummaryrefslogtreecommitdiff
path: root/src/Queue.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-08 15:28:08 +0100
committerMax Kellermann <max@duempel.org>2013-01-08 16:04:10 +0100
commitce57b8b6dfaae1655e4bdccd6ae600237cc50b38 (patch)
treecb1c53c430480e99a0fe881fffb5d4315eb6745e /src/Queue.hxx
parentd81a9029dbf49f880f0a8d2a89b37d0d53d7cc6f (diff)
Queue: move HASH_MULT and Item into the Queue class
Diffstat (limited to 'src/Queue.hxx')
-rw-r--r--src/Queue.hxx56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/Queue.hxx b/src/Queue.hxx
index dcf431bc..9e1bde3a 100644
--- a/src/Queue.hxx
+++ b/src/Queue.hxx
@@ -28,35 +28,6 @@
#include <assert.h>
#include <stdint.h>
-enum {
- /**
- * reserve max_length * QUEUE_HASH_MULT elements in the id
- * number space
- */
- QUEUE_HASH_MULT = 4,
-};
-
-/**
- * One element of the queue: basically a song plus some queue specific
- * information attached.
- */
-struct queue_item {
- struct song *song;
-
- /** the unique id of this item in the queue */
- unsigned id;
-
- /** when was this item last changed? */
- uint32_t version;
-
- /**
- * The priority of this item, between 0 and 255. High
- * priority value means that this song gets played first in
- * "random" mode.
- */
- uint8_t priority;
-};
-
/**
* A queue of songs. This is the backend of the playlist: it contains
* an ordered list of songs.
@@ -68,6 +39,33 @@ struct queue_item {
* - the order number (which only differs from "position" in random mode)
*/
struct queue {
+ /**
+ * reserve max_length * QUEUE_HASH_MULT elements in the id
+ * number space
+ */
+ static constexpr unsigned QUEUE_HASH_MULT = 4;
+
+ /**
+ * One element of the queue: basically a song plus some queue specific
+ * information attached.
+ */
+ struct queue_item {
+ struct song *song;
+
+ /** the unique id of this item in the queue */
+ unsigned id;
+
+ /** when was this item last changed? */
+ uint32_t version;
+
+ /**
+ * The priority of this item, between 0 and 255. High
+ * priority value means that this song gets played first in
+ * "random" mode.
+ */
+ uint8_t priority;
+ };
+
/** configured maximum length of the queue */
unsigned max_length;