Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
ModIo.cpp File Reference
#include "precompiled.h"
#include "ModIo.h"
#include "i18n/L10n.h"
#include "lib/file/file_system.h"
#include "lib/sysdep/filesystem.h"
#include "lib/sysdep/sysdep.h"
#include "maths/MD5.h"
#include "ps/CLogger.h"
#include "ps/ConfigDB.h"
#include "ps/GameSetup/CmdLineArgs.h"
#include "ps/GameSetup/Paths.h"
#include "ps/Mod.h"
#include "ps/ModInstaller.h"
#include "ps/Util.h"
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptContext.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/JSON.h"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/split.hpp>
#include <iomanip>
Include dependency graph for ModIo.cpp:

Classes

struct  DownloadCallbackData
 

Macros

#define FAIL(...)   STMT(err = fmt::sprintf(__VA_ARGS__); CLEANUP(); return false;)
 
#define CLEANUP()   id = -1;
 
#define CLEANUP()   modData.clear();
 
#define INVALIDATE_DATA_AND_CONTINUE(...)
 
#define COPY_STRINGS_ELSE_CONTINUE(prefix, obj, ...)
 
#define CLEANUP()   sig = {};
 

Variables

ModIog_ModIo = nullptr
 

Macro Definition Documentation

◆ CLEANUP [1/3]

#define CLEANUP ( )    id = -1;

◆ CLEANUP [2/3]

#define CLEANUP ( )    modData.clear();

◆ CLEANUP [3/3]

#define CLEANUP ( )    sig = {};

◆ COPY_STRINGS_ELSE_CONTINUE

#define COPY_STRINGS_ELSE_CONTINUE (   prefix,
  obj,
  ... 
)
Value:
for (const std::string& prop : { __VA_ARGS__ }) \
{ \
std::string val; \
if (!Script::FromJSProperty(rq, obj, prop.c_str(), val, true)) \
{ \
ok = false; \
copyStringError = "Failed to get " + prop + " from " + #obj + "."; \
break; \
}\
data.properties.emplace(prefix+prop, val); \
} \
if (!ok) \
INVALIDATE_DATA_AND_CONTINUE(copyStringError);
bool FromJSProperty(const ScriptRequest &rq, const JS::HandleValue val, const char *name, T &ret, bool strict=false)
Convert a named property of an object to a C++ type.
Definition: ScriptConversions.h:71

◆ FAIL

#define FAIL (   ...)    STMT(err = fmt::sprintf(__VA_ARGS__); CLEANUP(); return false;)

◆ INVALIDATE_DATA_AND_CONTINUE

#define INVALIDATE_DATA_AND_CONTINUE (   ...)
Value:
{\
data.properties.emplace("invalid", "true");\
data.properties.emplace("error", __VA_ARGS__);\
continue;\
}

Variable Documentation

◆ g_ModIo

ModIo* g_ModIo = nullptr