#include #include "any.h" #include "memory_Context.h" #include 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(value); } else if (fieldName == "exit") { exit = libany::any_cast(value); } else if (fieldName == "hiddenItems") { hiddenItems = libany::any_cast >(value); } else if (fieldName == "input") { std::cout << "memory_Context-01\n"; try { input = libany::any_cast(value); } catch (libany::bad_any_cast &e) { std::cout << "memory_Context-01 exception/type: " << e.what() << ", " << value.type().name() << std::endl; } std::cout << "memory_Context-02\n"; } else if (fieldName == "mismatchedItems") { mismatchedItems = libany::any_cast >(value); } else if (fieldName == "outputGoOn") { outputGoOn = libany::any_cast(value); } else if (fieldName == "outputGreeting") { outputGreeting = libany::any_cast(value); } else if (fieldName == "outputHelp") { outputHelp = libany::any_cast(value); } else if (fieldName == "outputMatchedItems") { outputMatchedItems = libany::any_cast(value); } else if (fieldName == "outputMismatchedItems") { outputMismatchedItems = libany::any_cast(value); } else if (fieldName == "outputPromptSelection") { outputPromptSelection = libany::any_cast(value); } else if (fieldName == "outputVictory") { outputVictory = libany::any_cast(value); } else if (fieldName == "playfieldItems") { playfieldItems = libany::any_cast >(value); } else if (fieldName == "playfieldSize") { playfieldSize = libany::any_cast(value); } else if (fieldName == "selectedId") { selectedId = libany::any_cast(value); } else if (fieldName == "selectedItems") { selectedItems = libany::any_cast >(value); } else if (fieldName == "victory") { victory = libany::any_cast(value); } } memory_Context memory_createContext() { return memory_Context(); }