Михаил Капелько pirms 6 mēnešiem
vecāks
revīzija
f265104856
3 mainītis faili ar 24 papildinājumiem un 26 dzēšanām
  1. +1
    -3
      v4/gen-C++
  2. +20
    -20
      v4/memory_Context.cpp
  3. +3
    -3
      v4/memory_Context.h

+ 1
- 3
v4/gen-C++ Parādīt failu

@@ -1,6 +1,4 @@
#c++ -o test_memory_C++ -std=c++11 -I. \
#c++ -o test_memory_C++ -std=c++17 -I. \
c++ -o test_memory_C++ -std=c++20 -I. \
c++ -o test_memory_C++ -std=c++11 -I. \
memory.cpp \
memory_Context.cpp \
memory_test.cpp \


+ 20
- 20
v4/memory_Context.cpp Parādīt failu

@@ -1,9 +1,9 @@
#include <any>
#include "any.h"
#include "memory_Context.h"

#include <iostream>

std::any memory_Context::field(const std::string &fieldName) {
libany::any memory_Context::field(const std::string &fieldName) {
if (fieldName == "didLaunch") {
return didLaunch;
} else if (fieldName == "exit") {
@@ -41,41 +41,41 @@ std::any memory_Context::field(const std::string &fieldName) {
return victory;
}

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



+ 3
- 3
v4/memory_Context.h Parādīt failu

@@ -1,7 +1,7 @@
#include <any>
#include <map>
#include <string>
#include <vector>
#include "any.h"
#include "ctx.h"

#ifndef memory_Context_HEADER
@@ -27,8 +27,8 @@ struct memory_Context {
std::vector<int> selectedItems;
bool victory = false;

std::any field(const std::string &fieldName);
void setField(const std::string &fieldName, std::any value);
libany::any field(const std::string &fieldName);
void setField(const std::string &fieldName, libany::any value);
};

memory_Context memory_createContext();


Notiek ielāde…
Atcelt
Saglabāt