#include "RecipieGroupConfig.h" #include "Game.h" RecipieGroupConfig::RecipieGroupConfig() : Framework::ReferenceCounter() {} void RecipieGroupConfig::setGroupName(const Framework::Text& groupName) { this->groupName = groupName; } const Framework::Text& RecipieGroupConfig::getGroupName() const { return groupName; } void RecipieGroupConfig::setIconItemType(const Framework::Text& iconItemType) { this->iconItemType = iconItemType; } const Framework::Text& RecipieGroupConfig::getIconItemType() const { return iconItemType; } RecipieGroupConfigFactory::RecipieGroupConfigFactory() : ObjectTypeFactory() {} RecipieGroupConfig* RecipieGroupConfigFactory::fromJson( Framework::JSON::JSONObject* zJson) const { RecipieGroupConfig* config = new RecipieGroupConfig(); config->setGroupName(zJson->zValue("groupName")->asString()->getString()); config->setIconItemType( zJson->zValue("iconItemType")->asString()->getString()); return config; } Framework::JSON::JSONObject* RecipieGroupConfigFactory::toJsonObject( RecipieGroupConfig* zObject) const { Framework::JSON::JSONObject* result = new Framework::JSON::JSONObject(); result->addValue("groupName", new Framework::JSON::JSONString(zObject->getGroupName().getText())); result->addValue("iconItemType", new Framework::JSON::JSONString(zObject->getIconItemType().getText())); return result; } JSONObjectValidationBuilder* RecipieGroupConfigFactory::addToValidator( JSONObjectValidationBuilder* builder) const { return builder->withRequiredString("groupName") ->finishString() ->withRequiredAttribute("iconItemType", Game::INSTANCE->zTypeRegistry()->getValidator( ItemTypeNameFactory::TYPE_ID)); }