Refactor save jukebox handling into its own class
[lsnes.git] / include / core / jukebox.hpp
blob191e09f173b4990f5af4a3d83db254751bb22114
1 #ifndef _jukebox__hpp__included__
2 #define _jukebox__hpp__included__
4 #include <functional>
5 #include <cstdlib>
6 #include <string>
8 namespace settingvar { class group; }
10 class save_jukebox_listener;
12 /**
13 * Save jukebox.
15 class save_jukebox
17 public:
18 /**
19 * Ctor.
21 save_jukebox(settingvar::group& _settings);
22 /**
23 * Dtor.
25 ~save_jukebox();
26 /**
27 * Get current slot.
29 * Throws std::runtime_exception: No slot selected.
31 size_t get_slot();
32 /**
33 * Set current slot.
35 * Parameter slot: The slot to select.
36 * Throws std::runtime_exception: Slot out of range.
38 void set_slot(size_t slot);
39 /**
40 * Cycle next slot.
42 * Throws std::runtime_exception: No slot selected.
44 void cycle_next();
45 /**
46 * Cycle previous slot.
48 * Throws std::runtime_exception: No slot selected.
50 void cycle_prev();
51 /**
52 * Get save as binary flag.
54 bool save_binary();
55 /**
56 * Get name of current jukebox slot.
58 * Throws std::runtime_exception: No slot selected.
60 std::string get_slot_name();
61 /**
62 * Set size of jukebox.
64 * Parameter size: The new size.
66 void set_size(size_t size);
67 /**
68 * Set update function.
70 void set_update(std::function<void()> _update);
71 /**
72 * Unset update function.
74 void unset_update();
75 private:
76 settingvar::group& settings;
77 size_t current_slot;
78 size_t current_size;
79 std::function<void()> update;
80 save_jukebox_listener* listener;
83 #endif