Allow button display symbols to be Unicode characters
[lsnes.git] / include / library / emustatus.hpp
blob18d84f7128df739f18f66b3374f614dff122c0ea
1 #ifndef _library__emustatus__hpp__included__
2 #define _library__emustatus__hpp__included__
4 #include "threadtypes.hpp"
6 #include <map>
7 #include <string>
8 #include "utf8.hpp"
10 class emulator_status
12 public:
13 /**
14 * Constructor.
16 * Throws std::bad_alloc: Not enough memory.
18 emulator_status() throw(std::bad_alloc);
19 /**
20 * Destructor
22 ~emulator_status() throw();
23 /**
24 * Insert/Replace key.
26 * Parameter key: Key to insert/replace.
27 * Parameter value: The value to assign.
28 * Throws std::bad_alloc: Not enough memory.
30 void set(const std::string& key, const std::string& value) throw(std::bad_alloc);
31 /**
32 * Insert/Replace key.
34 * Parameter key: Key to insert/replace.
35 * Parameter value: The value to assign.
36 * Throws std::bad_alloc: Not enough memory.
38 void set(const std::string& key, const std::u32string& value) throw(std::bad_alloc);
39 /**
40 * Has key?
42 * Parameter key: Key to check.
43 * Returns: True if key exists, false if not.
45 bool haskey(const std::string& key) throw();
46 /**
47 * Erase key.
49 * Parameter key: Key to erase.
51 void erase(const std::string& key) throw();
52 /**
53 * Read key.
55 * Parameter key: The key to read.
56 * Returns: The value of key ("" if not found).
58 std::u32string get(const std::string& key) throw(std::bad_alloc);
59 /**
60 * Iterator.
62 struct iterator
64 /**
65 * Not valid flag.
67 bool not_valid;
68 /**
69 * Key.
71 std::string key;
72 /**
73 * Value.
75 std::u32string value;
77 /**
78 * Get first iterator
80 * Returns: Before-the-start iterator.
81 * Throws std::bad_alloc: Not enough memory.
83 iterator first() throw(std::bad_alloc);
84 /**
85 * Get next value.
87 * Parameter itr: Iterator to advance.
88 * Returns: True if next value was found, false if not.
89 * Throws std::bad_alloc: Not enough memory.
91 bool next(iterator& itr) throw(std::bad_alloc);
92 private:
93 emulator_status(const emulator_status&);
94 emulator_status& operator=(const emulator_status&);
95 mutex_class lock;
96 std::map<std::string, std::u32string> content;
99 #endif