|
- #include <utility>
- #include "any.h"
- #include "memory_Context.h"
-
- libany::any memory_Context::field(const std::string &fieldName) {
- if (fieldName == "didLaunch") {
- return didLaunch;
- } else if (fieldName == "exit") {
- return exit;
- } else if (fieldName == "hiddenItems") {
- return hiddenItems;
- } else if (fieldName == "input") {
- return input;
- } else if (fieldName == "mismatchedItems") {
- return mismatchedItems;
- } else if (fieldName == "outputGoOn") {
- return outputGoOn;
- } else if (fieldName == "outputGreeting") {
- return outputGreeting;
- } else if (fieldName == "outputHelp") {
- return outputHelp;
- } else if (fieldName == "outputMatchedItems") {
- return outputMatchedItems;
- } else if (fieldName == "outputMismatchedItems") {
- return outputMismatchedItems;
- } else if (fieldName == "outputPromptSelection") {
- return outputPromptSelection;
- } else if (fieldName == "outputVictory") {
- return outputVictory;
- } else if (fieldName == "playfieldItems") {
- return playfieldItems;
- } else if (fieldName == "playfieldSize") {
- return playfieldSize;
- } else if (fieldName == "selectedId") {
- return selectedId;
- } else if (fieldName == "selectedItems") {
- return selectedItems;
- }
- // victory
- return victory;
- }
-
- void memory_Context::setField(const std::string &fieldName, libany::any value) {
- if (fieldName == "didLaunch") {
- didLaunch = libany::any_cast<bool>(value);
- } else if (fieldName == "exit") {
- exit = libany::any_cast<bool>(value);
- } else if (fieldName == "hiddenItems") {
- hiddenItems = libany::any_cast<std::vector<int> >(value);
- } else if (fieldName == "input") {
- input = libany::any_cast<std::string>(value);
- } else if (fieldName == "mismatchedItems") {
- mismatchedItems = libany::any_cast<std::vector<int> >(value);
- } else if (fieldName == "outputGoOn") {
- outputGoOn = libany::any_cast<std::string>(value);
- } else if (fieldName == "outputGreeting") {
- outputGreeting = libany::any_cast<std::string>(value);
- } else if (fieldName == "outputHelp") {
- outputHelp = libany::any_cast<std::string>(value);
- } else if (fieldName == "outputMatchedItems") {
- outputMatchedItems = libany::any_cast<std::string>(value);
- } else if (fieldName == "outputMismatchedItems") {
- outputMismatchedItems = libany::any_cast<std::string>(value);
- } else if (fieldName == "outputPromptSelection") {
- outputPromptSelection = libany::any_cast<std::string>(value);
- } else if (fieldName == "outputVictory") {
- outputVictory = libany::any_cast<std::string>(value);
- } else if (fieldName == "playfieldItems") {
- playfieldItems = libany::any_cast<std::map<int, int> >(value);
- } else if (fieldName == "playfieldSize") {
- playfieldSize = libany::any_cast<int>(value);
- } else if (fieldName == "selectedId") {
- selectedId = libany::any_cast<int>(value);
- } else if (fieldName == "selectedItems") {
- selectedItems = libany::any_cast<std::vector<int> >(value);
- } else if (fieldName == "victory") {
- victory = libany::any_cast<bool>(value);
- }
- }
-
- memory_Context memory_createContext() {
- return memory_Context();
- }
|