diff --git a/include/core/window.hpp b/include/core/window.hpp index 85273800..939fcf0c 100644 --- a/include/core/window.hpp +++ b/include/core/window.hpp @@ -5,15 +5,12 @@ #include "interface/romtype.hpp" #include "library/keyboard.hpp" #include "library/messagebuffer.hpp" -#include "library/emustatus.hpp" #include "library/framebuffer.hpp" #include #include #include #include -class emulator_status; - /** * Information about keypress. */ @@ -165,12 +162,6 @@ struct platform * throws std::bad_alloc: Not enough memory. */ static std::ostream& out() throw(std::bad_alloc); -/** - * Get emulator status area - * - * returns: Emulator status area. - */ - static emulator_status& get_emustatus() throw(); /** * Message buffer. */ diff --git a/include/library/emustatus.hpp b/include/library/emustatus.hpp deleted file mode 100644 index 2f2c2ba9..00000000 --- a/include/library/emustatus.hpp +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef _library__emustatus__hpp__included__ -#define _library__emustatus__hpp__included__ - -#include "threads.hpp" - -#include -#include -#include "utf8.hpp" - -class emulator_status -{ -public: -/** - * Constructor. - * - * Throws std::bad_alloc: Not enough memory. - */ - emulator_status() throw(std::bad_alloc); -/** - * Destructor - */ - ~emulator_status() throw(); -/** - * Insert/Replace key. - * - * Parameter key: Key to insert/replace. - * Parameter value: The value to assign. - * Throws std::bad_alloc: Not enough memory. - */ - void set(const std::string& key, const std::string& value) throw(std::bad_alloc); -/** - * Insert/Replace key. - * - * Parameter key: Key to insert/replace. - * Parameter value: The value to assign. - * Throws std::bad_alloc: Not enough memory. - */ - void set(const std::string& key, const std::u32string& value) throw(std::bad_alloc); -/** - * Has key? - * - * Parameter key: Key to check. - * Returns: True if key exists, false if not. - */ - bool haskey(const std::string& key) throw(); -/** - * Erase key. - * - * Parameter key: Key to erase. - */ - void erase(const std::string& key) throw(); -/** - * Read key. - * - * Parameter key: The key to read. - * Returns: The value of key ("" if not found). - */ - std::u32string get(const std::string& key) throw(std::bad_alloc); -/** - * Iterator. - */ - struct iterator - { -/** - * Not valid flag. - */ - bool not_valid; -/** - * Key. - */ - std::string key; -/** - * Value. - */ - std::u32string value; - }; -/** - * Get first iterator - * - * Returns: Before-the-start iterator. - * Throws std::bad_alloc: Not enough memory. - */ - iterator first() throw(std::bad_alloc); -/** - * Get next value. - * - * Parameter itr: Iterator to advance. - * Returns: True if next value was found, false if not. - * Throws std::bad_alloc: Not enough memory. - */ - bool next(iterator& itr) throw(std::bad_alloc); -private: - emulator_status(const emulator_status&); - emulator_status& operator=(const emulator_status&); - threads::lock lock; - std::map content; -}; - -#endif diff --git a/src/core/window.cpp b/src/core/window.cpp index 4f3af6ef..8c48ca5d 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -94,8 +94,6 @@ namespace keyboard::invbind ienable_sound(lsnes_mapper, "enable-sound on", "Sound‣Enable"); keyboard::invbind idisable_sound(lsnes_mapper, "enable-sound off", "Sound‣Disable"); - emulator_status emustatus; - class window_output { public: @@ -149,11 +147,6 @@ namespace bool sounds_enabled = true; } -emulator_status& platform::get_emustatus() throw() -{ - return emustatus; -} - void platform::sound_enable(bool enable) throw() { audioapi_driver_enable(enable); diff --git a/src/library/emustatus.cpp b/src/library/emustatus.cpp deleted file mode 100644 index 99d3fef7..00000000 --- a/src/library/emustatus.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "emustatus.hpp" - -emulator_status::emulator_status() throw(std::bad_alloc) -{ -} - -emulator_status::~emulator_status() throw() -{ -} - -void emulator_status::set(const std::string& key, const std::string& value) throw(std::bad_alloc) -{ - threads::alock h(lock); - content[key] = utf8::to32(value); -} - -void emulator_status::set(const std::string& key, const std::u32string& value) throw(std::bad_alloc) -{ - threads::alock h(lock); - content[key] = value; -} - -bool emulator_status::haskey(const std::string& key) throw() -{ - threads::alock h(lock); - return (content.count(key) != 0); -} - -void emulator_status::erase(const std::string& key) throw() -{ - threads::alock h(lock); - content.erase(key); -} - -std::u32string emulator_status::get(const std::string& key) throw(std::bad_alloc) -{ - threads::alock h(lock); - return content[key]; -} - -emulator_status::iterator emulator_status::first() throw(std::bad_alloc) -{ - iterator i; - i.not_valid = true; - return i; -} - -bool emulator_status::next(iterator& itr) throw(std::bad_alloc) -{ - threads::alock h(lock); - std::map::iterator j; - if(itr.not_valid) - j = content.lower_bound(""); - else - j = content.upper_bound(itr.key); - if(j == content.end()) { - itr.not_valid = true; - itr.key = ""; - itr.value = U""; - return false; - } else { - itr.not_valid = false; - itr.key = j->first; - itr.value = j->second; - return true; - } -}