Files
UnrealEngineUWP/Engine/Source/Programs/PixelStreaming/SessionMonitor/src/CmdLine.h
Ryan Durand 9ef3748747 Updating copyrights for Engine Programs.
#rnx
#rb none
#jira none

#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869242 in //Fortnite/Release-12.00/... via CL 10869536
#ROBOMERGE-BOT: FORTNITE (Main -> Dev-EngineMerge) (v613-10869866)

[CL 10870955 by Ryan Durand in Main branch]
2019-12-26 23:01:54 -05:00

75 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "SessionMonitorCommon.h"
/**
* Utility class to parse command line parameters.
*
* Arguments need to be prefixed with '-' and can have the following formats:
* -SomeArg
* -SomeOtherArg=Value
*/
class FCmdLine
{
public:
struct FParam
{
template <class T1, class T2>
FParam(T1&& Name, T2&& Value)
: Name(std::forward<T1>(Name))
, Value(std::forward<T2>(Value))
{
}
std::string Name;
std::string Value;
};
FCmdLine()
{
}
/**
* Parse all the supplied parameters, as received in "main"
*/
bool Parse(int Argc, char* Argv[], bool CaseSensitive=false);
/**
* Checks if the specified parameter is present, in any acceptable form, such
* ash "-arg" or "-arg=value"
*/
bool Has(const char* Name) const;
/**
* Gets the value of the specified parameter.
* @return Value of the parameter or an empty string if the parameter doesn't
* exist or doesn't is not in the "-arg=value" form
* Use "Has" method first, to check if a parameter exists.
*/
const std::string& Get(const char* Name) const;
/**
* Gets the value of the specified parameter, as an integer
*
* @param Name Parameter name
* @param DefaultValue If the parameter doesn't exist or is not in the "-arg=value" form, it will default to this
* @return
* Pair where "first" is true if the parameter exists, false if not. "second" is the parameter's value or DefaultValue
*/
std::pair<bool, int> GetAsInt(const char* Name, int DefaultValue = 0) const;
/**
* @return The number of parameters
*/
int GetCount() const;
private:
bool Equals(const std::string& A, const char* B) const;
std::vector<FParam> Params;
static std::string Empty;
bool CaseSensitive = true;
};