FCommandLine
- Module
- Core
- Header
#include "Core/FCommandLine.h"- Namespace
Mowo
Public functions
| Returns | Name | Description |
|---|---|---|
void | Set | Subsequent calls overwrite. |
const std::string& | GetProgramName | Empty before Set() runs. |
const std::string& | GetFullCommandLine | |
bool | HasSwitch | True when --name (or -n for single-char) appears anywhere in argv. |
std::string | GetValue | Last value wins if --name appears multiple times. |
int | GetIntValue | |
float | GetFloatValue | |
const std::vector<std::string>& | GetAll | |
std::vector<std::string> | RestrictToPlayerArguments | Drops every argument a shipped game has no business honouring and logs what it dropped. |
const std::vector<FPlayerArgument>& | PlayerArgumentTable | |
const std::vector<std::string>& | PlayerArgumentAllowlist | The names alone, for the filter and for a host that wants to print them. |
bool | IsRestricted | True once RestrictToPlayerArguments has run, for a host that wants to state the policy in its log. |
Function details
Set
static void Set(int argc, const char* const* argv)Subsequent calls overwrite. Argv[0] is captured as GetProgramName() but skipped from switch / value parsing.
GetProgramName
static const std::string& GetProgramName()Empty before Set() runs.
GetFullCommandLine
static const std::string& GetFullCommandLine()HasSwitch
static bool HasSwitch(std::string_view name)True when --name (or -n for single-char) appears anywhere in argv.
GetValue
static std::string GetValue(std::string_view name, std::string_view defaultValue = "")Last value wins if --name appears multiple times. Returns defaultValue if missing or value-less.
GetIntValue
static int GetIntValue(std::string_view name, int defaultValue = 0)GetFloatValue
static float GetFloatValue(std::string_view name, float defaultValue = 0.0f)GetAll
static const std::vector<std::string>& GetAll()RestrictToPlayerArguments
static std::vector<std::string> RestrictToPlayerArguments(const std::vector<std::string>& allowExtra = {})Drops every argument a shipped game has no business honouring and logs what it dropped. Called once by the game host right after Set(); the editor, the tests and the server never call it. A packaged game's command line is user-editable — a shortcut, a Steam launch option, a batch file someone found online — and everything in the engine reads from here: --cvar= reaches every console variable, --scene loads any file on disk, the self-test and profiling switches start machinery a player should never be inside. Keeping the parse and filtering the RESULT (rather than teaching each reader to re-check) is what makes the guarantee hold for code that has not been written yet. What survives is the player-facing set: the graphics backend shorthands, window/display, audio, language, the multiplayer join arguments and the save slot. allowExtra lets a game module widen it with its own switches (no leading dashes, no values). Returns what it dropped, in argv order, for the caller to log — Core sits below Logging.
PlayerArgumentTable
static const std::vector<FPlayerArgument>& PlayerArgumentTable()PlayerArgumentAllowlist
static const std::vector<std::string>& PlayerArgumentAllowlist()The names alone, for the filter and for a host that wants to print them.
IsRestricted
static bool IsRestricted()True once RestrictToPlayerArguments has run, for a host that wants to state the policy in its log.