Changeset View
Changeset View
Standalone View
Standalone View
source/ps/scripting/JSInterface_Hotkey.cpp
Show All 13 Lines | |||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "JSInterface_Hotkey.h" | #include "JSInterface_Hotkey.h" | ||||
#include <unordered_map> | |||||
#include <vector> | |||||
#include "lib/external_libraries/libsdl.h" | #include "lib/external_libraries/libsdl.h" | ||||
#include "ps/CLogger.h" | |||||
#include "ps/Hotkey.h" | #include "ps/Hotkey.h" | ||||
#include "ps/KeyName.h" | #include "ps/KeyName.h" | ||||
#include "scriptinterface/ScriptConversions.h" | #include "scriptinterface/ScriptConversions.h" | ||||
#include <unordered_map> | |||||
#include <vector> | |||||
#include <set> | |||||
/** | /** | ||||
* Convert an unordered map to a JS object, mapping keys to values. | * Convert an unordered map to a JS object, mapping keys to values. | ||||
* Assumes T to have a c_str() method that returns a const char* | * Assumes T to have a c_str() method that returns a const char* | ||||
* NB: this is unordered since no particular effort is made to preserve order. | * NB: this is unordered since no particular effort is made to preserve order. | ||||
* TODO: this could be moved to ScriptConversions.cpp if the need arises. | * TODO: this could be moved to ScriptConversions.cpp if the need arises. | ||||
*/ | */ | ||||
template<typename T, typename U> | template<typename T, typename U> | ||||
static void ToJSVal_unordered_map(const ScriptRequest& rq, JS::MutableHandleValue ret, const std::unordered_map<T, U>& val) | static void ToJSVal_unordered_map(const ScriptRequest& rq, JS::MutableHandleValue ret, const std::unordered_map<T, U>& val) | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator