game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
anonymous_namespace{game.cpp} Namespace Reference

Functions

std::string captureUnknownKeys (const gjson &src, const std::set< std::string > &known)
 Extract any keys not in known into a JSON object string.
bool jbool (const gjson &j, const char *key, bool def=false)
double jdouble (const gjson &j, const char *key, double def=0.0)
int jint (const gjson &j, const char *key, int def=0)
int64_t jint64 (const gjson &j, const char *key, int64_t def=0)
std::string jstr (const gjson &j, const char *key, const char *def="")
 Type-tolerant getter helpers — return defaultVal when the key is missing or the value is the wrong type.
const std::set< std::string > & kKnownMetadataKeys ()
const std::set< std::string > & kKnownRunnerConfigKeys ()
 Set of keys that the typed struct knows about.
void mergeUnknownKeys (gjson &dst, const std::string &extrasStr)
 Inverse of captureUnknownKeys: merge stashed unknowns into the JSON object we're about to serialise.

Function Documentation

◆ captureUnknownKeys()

std::string anonymous_namespace{game.cpp}::captureUnknownKeys ( const gjson & src,
const std::set< std::string > & known )

Extract any keys not in known into a JSON object string.

Used to preserve forward-compatible fields we don't recognise yet. Returns empty string when there are no unknown keys.

Definition at line 605 of file game.cpp.

◆ jbool()

bool anonymous_namespace{game.cpp}::jbool ( const gjson & j,
const char * key,
bool def = false )

Definition at line 587 of file game.cpp.

◆ jdouble()

double anonymous_namespace{game.cpp}::jdouble ( const gjson & j,
const char * key,
double def = 0.0 )

Definition at line 580 of file game.cpp.

◆ jint()

int anonymous_namespace{game.cpp}::jint ( const gjson & j,
const char * key,
int def = 0 )

Definition at line 571 of file game.cpp.

◆ jint64()

int64_t anonymous_namespace{game.cpp}::jint64 ( const gjson & j,
const char * key,
int64_t def = 0 )

Definition at line 594 of file game.cpp.

◆ jstr()

std::string anonymous_namespace{game.cpp}::jstr ( const gjson & j,
const char * key,
const char * def = "" )

Type-tolerant getter helpers — return defaultVal when the key is missing or the value is the wrong type.

nlohmann::json::value(...) throws on type mismatch; this wrapper makes deserialisation forgiving in the same way the prior text-scanner was forgiving.

Definition at line 564 of file game.cpp.

◆ kKnownMetadataKeys()

const std::set< std::string > & anonymous_namespace{game.cpp}::kKnownMetadataKeys ( )

Definition at line 525 of file game.cpp.

◆ kKnownRunnerConfigKeys()

const std::set< std::string > & anonymous_namespace{game.cpp}::kKnownRunnerConfigKeys ( )

Set of keys that the typed struct knows about.

Keys not in this set are stashed into unknownJsonExtras for round-trip preservation. Wrapped in Meyer's-singleton accessors below: file-scope static const std::set <std::string> is bugprone-throwing-static-initialization / CERT ERR58-CPP because std::string allocations within set construction aren't catchable at static init.

Definition at line 478 of file game.cpp.

◆ mergeUnknownKeys()

void anonymous_namespace{game.cpp}::mergeUnknownKeys ( gjson & dst,
const std::string & extrasStr )

Inverse of captureUnknownKeys: merge stashed unknowns into the JSON object we're about to serialise.

Known keys we just wrote take precedence — the stash is ONLY for keys we don't know about, so a collision means a user edit-and-save took ownership of that key.

Definition at line 624 of file game.cpp.

References Logger::warn().