Plasma Engine  2.0
Loading...
Searching...
No Matches
plCommandLineOptionFloat Class Reference

This command line option exposes float values, optionally with a min/max range. More...

#include <CommandLineOptions.h>

Inheritance diagram for plCommandLineOptionFloat:

Public Member Functions

 plCommandLineOptionFloat (plStringView sSortingGroup, plStringView sArgument, plStringView sLongDesc, float fDefaultValue, float fMinValue=plMath::MinValue< float >(), float fMaxValue=plMath::MaxValue< float >(), bool bCaseSensitive=false)
 
virtual void GetParamDefaultValueDesc (plStringBuilder &ref_sOut) const override
 Returns a very short string for the options default value. For example "0" or "auto".
 
virtual void GetParamShortDesc (plStringBuilder &ref_sOut) const override
 Returns a very short description of the option (type). For example "<int>" or "<enum>".
 
float GetOptionValue (LogMode logMode, const plCommandLineUtils *pUtils=plCommandLineUtils::GetGlobalInstance()) const
 Returns the value of this option. Either what was specified on the command line, or the default value.
 
void SetDefaultValue (float value)
 Modifies the default value.
 
virtual plStringView GetType () override
 Returns "Float".
 
float GetMinValue () const
 Returns the minimum value.
 
float GetMaxValue () const
 Returns the maximum value.
 
float GetDefaultValue () const
 Returns the default value.
 
- Public Member Functions inherited from plCommandLineOptionDoc
 plCommandLineOptionDoc (plStringView sSortingGroup, plStringView sArgument, plStringView sParamShortDesc, plStringView sLongDesc, plStringView sDefaultValue, bool bCaseSensitive=false)
 
virtual void GetOptions (plStringBuilder &ref_sOut) const override
 Writes all the supported options (e.g. '-arg') to 'out'. If more than one option is allowed, they should be separated with semicolons or pipes.
 
virtual void GetLongDesc (plStringBuilder &ref_sOut) const override
 Returns a proper description of the option.
 
bool IsOptionSpecified (plStringBuilder *out_pWhich=nullptr, const plCommandLineUtils *pUtils=plCommandLineUtils::GetGlobalInstance()) const
 Checks whether any of the option variants is set on the command line, and returns which one. For example '-h' or '-help'.
 
- Public Member Functions inherited from plCommandLineOption
 plCommandLineOption (plStringView sSortingGroup)
 
virtual void GetSortingGroup (plStringBuilder &ref_sOut) const
 Writes the sorting group name to 'out'.
 
void GetSplitOptions (plStringBuilder &out_sAll, plDynamicArray< plStringView > &ref_splitOptions) const
 Returns the supported option names (e.g. '-arg') as split strings.
 

Protected Attributes

float m_fDefaultValue = 0
 
float m_fMinValue = 0
 
float m_fMaxValue = 0
 
- Protected Attributes inherited from plCommandLineOptionDoc
plStringView m_sArgument
 
plStringView m_sParamShortDesc
 
plStringView m_sParamDefaultValue
 
plStringView m_sLongDesc
 
bool m_bCaseSensitive = false
 
bool m_bLoggedOnce = false
 
- Protected Attributes inherited from plCommandLineOption
plStringView m_sSortingGroup
 
- Protected Attributes inherited from plEnumerable< plCommandLineOption >
plEnumerablem_pNextInstance
 

Additional Inherited Members

- Public Types inherited from plCommandLineOption
enum class  LogAvailableModes { Always , IfHelpRequested }
 
enum class  LogMode {
  Never , FirstTime , FirstTimeIfSpecified , Always ,
  AlwaysIfSpecified
}
 Describes whether the value of an option (and whether something went wrong), should be printed to plLog. More...
 
- Static Public Member Functions inherited from plCommandLineOption
static bool IsHelpRequested (const plCommandLineUtils *pUtils=plCommandLineUtils::GetGlobalInstance())
 Checks whether a command line was passed that requests help output.
 
static plResult RequireOptions (plStringView sRequiredOptions, plString *pMissingOption=nullptr, const plCommandLineUtils *pUtils=plCommandLineUtils::GetGlobalInstance())
 Checks whether all required options are passed to the command line.
 
static bool LogAvailableOptions (LogAvailableModes mode, plStringView sGroupFilter={}, const plCommandLineUtils *pUtils=plCommandLineUtils::GetGlobalInstance())
 Prints all available options to the plLog.
 
static bool LogAvailableOptionsToBuffer (plStringBuilder &out_sBuffer, LogAvailableModes mode, plStringView sGroupFilter={}, const plCommandLineUtils *pUtils=plCommandLineUtils::GetGlobalInstance())
 Same as LogAvailableOptions() but captures the output from plLog and returns it in an plStringBuilder.
 
- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 
- Protected Member Functions inherited from plCommandLineOptionDoc
bool ShouldLog (LogMode mode, bool bWasSpecified) const
 
void LogOption (plStringView sOption, plStringView sValue, bool bWasSpecified) const
 

Detailed Description

This command line option exposes float values, optionally with a min/max range.

If the user specified a value outside the allowed range, a warning is printed, and the default value is used instead. It is valid for the default value to be outside the min/max range, which can be used to detect whether the user provided any value at all.

Member Function Documentation

◆ GetParamDefaultValueDesc()

void plCommandLineOptionFloat::GetParamDefaultValueDesc ( plStringBuilder & ref_sOut) const
overridevirtual

Returns a very short string for the options default value. For example "0" or "auto".

Reimplemented from plCommandLineOptionDoc.

◆ GetParamShortDesc()

void plCommandLineOptionFloat::GetParamShortDesc ( plStringBuilder & ref_sOut) const
overridevirtual

Returns a very short description of the option (type). For example "<int>" or "<enum>".

Reimplemented from plCommandLineOptionDoc.

◆ GetType()

virtual plStringView plCommandLineOptionFloat::GetType ( )
inlineoverridevirtual

Returns "Float".

Reimplemented from plCommandLineOptionDoc.


The documentation for this class was generated from the following files: