ParamKit
A small library helping to parse commandline parameters (for Windows).
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
paramkit::EnumParam Class Reference

A parameter storing an enum value. More...

#include <param.h>

Inheritance diagram for paramkit::EnumParam:
Inheritance graph
[legend]

Public Member Functions

 EnumParam (const std::string &_argStr, const std::string _enumName, bool _isRequired)
 
bool addEnumValue (int value, const std::string &info)
 
bool addEnumValue (int value, const std::string &str_val, const std::string &info)
 
virtual std::string valToString () const
 Returns the string representation of the parameter's value. More...
 
virtual std::string type () const
 Returns the string representation of the parameter's type. More...
 
virtual bool isSet () const
 Returns true if the parameter is filled, false otherwise. More...
 
virtual bool isKeywordInType (const std::string &keyword)
 Checks if the parameter type contains the keyword. More...
 
bool isKeywordInDescription (const std::string &keyword)
 Checks if the description contains the keyword. More...
 
virtual bool parse (const char *arg)
 Parses the parameter from the given string. More...
 
- Public Member Functions inherited from paramkit::Param
 Param (const std::string &_argStr, bool _isRequired)
 A constructor of a parameter. More...
 
 Param (const std::string &_argStr, const std::string &_typeDescStr, bool _isRequired)
 A constructor of a parameter. More...
 
virtual bool parse (const wchar_t *arg)
 Parses the parameter from the given wide string. More...
 
void setActive (bool _active)
 
virtual bool isActive () const
 Returns true if the parameter is active, false otherwise. More...
 
virtual std::string info (bool isExtended) const
 
void printInColor (int color)
 Prints the parameter using the given color. Appends the parameter switch to the name. More...
 

Public Attributes

int value
 

Protected Member Functions

std::string extendedInfo () const
 Extended information. More...
 
std::string optionsInfo () const
 
bool isInEnumScope (int intVal) const
 
- Protected Member Functions inherited from paramkit::Param
void printDesc (bool isExtended=true) const
 Prints a formatted description of the parameter, including its unique name, type, and the info. More...
 
virtual bool isNameSimilar (const std::string &filter)
 Checks if the param name is similar to the given filter. More...
 

Protected Attributes

std::map< int, std::string > enumToString
 optional: string representation of the enum parameter More...
 
std::map< int, std::string > enumToInfo
 required: info about the enum parameter More...
 
std::string enumName
 
bool m_isSet
 
- Protected Attributes inherited from paramkit::Param
std::string argStr
 a unique name of the parameter More...
 
std::string typeDescStr
 a description of the type of the parameter: what type of values are allowed More...
 
std::string m_info
 a basic information about the the parameter's purpose More...
 
std::string m_extInfo
 an extended information about the the parameter's purpose More...
 
bool isRequired
 a flag indicating if this parameter is required More...
 
bool requiredArg
 a flag indicating if this parameter needs to be followed by a value More...
 
bool active
 a flag indicating if this parameter is available More...
 

Detailed Description

A parameter storing an enum value.

Definition at line 421 of file param.h.

Constructor & Destructor Documentation

◆ EnumParam()

paramkit::EnumParam::EnumParam ( const std::string &  _argStr,
const std::string  _enumName,
bool  _isRequired 
)
inline

Definition at line 423 of file param.h.

Member Function Documentation

◆ addEnumValue() [1/2]

bool paramkit::EnumParam::addEnumValue ( int  value,
const std::string &  info 
)
inline

Definition at line 430 of file param.h.

Here is the call graph for this function:

◆ addEnumValue() [2/2]

bool paramkit::EnumParam::addEnumValue ( int  value,
const std::string &  str_val,
const std::string &  info 
)
inline

Definition at line 436 of file param.h.

Here is the call graph for this function:

◆ extendedInfo()

std::string paramkit::EnumParam::extendedInfo ( ) const
inlineprotectedvirtual

Extended information.

Reimplemented from paramkit::Param.

Definition at line 530 of file param.h.

Here is the call graph for this function:

◆ isInEnumScope()

bool paramkit::EnumParam::isInEnumScope ( int  intVal) const
inlineprotected

Definition at line 561 of file param.h.

◆ isKeywordInDescription()

bool paramkit::EnumParam::isKeywordInDescription ( const std::string &  keyword)
inlinevirtual

Checks if the description contains the keyword.

Reimplemented from paramkit::Param.

Definition at line 480 of file param.h.

Here is the call graph for this function:

◆ isKeywordInType()

virtual bool paramkit::EnumParam::isKeywordInType ( const std::string &  keyword)
inlinevirtual

Checks if the parameter type contains the keyword.

Reimplemented from paramkit::Param.

Definition at line 472 of file param.h.

Here is the call graph for this function:

◆ isSet()

virtual bool paramkit::EnumParam::isSet ( ) const
inlinevirtual

Returns true if the parameter is filled, false otherwise.

Implements paramkit::Param.

Definition at line 463 of file param.h.

Here is the call graph for this function:

◆ optionsInfo()

std::string paramkit::EnumParam::optionsInfo ( ) const
inlineprotected

Definition at line 538 of file param.h.

Here is the call graph for this function:

◆ parse()

virtual bool paramkit::EnumParam::parse ( const char *  arg)
inlinevirtual

Parses the parameter from the given string.

Implements paramkit::Param.

Definition at line 498 of file param.h.

Here is the call graph for this function:

◆ type()

virtual std::string paramkit::EnumParam::type ( ) const
inlinevirtual

Returns the string representation of the parameter's type.

Implements paramkit::Param.

Definition at line 458 of file param.h.

◆ valToString()

virtual std::string paramkit::EnumParam::valToString ( ) const
inlinevirtual

Returns the string representation of the parameter's value.

Implements paramkit::Param.

Definition at line 444 of file param.h.

Here is the call graph for this function:

Member Data Documentation

◆ enumName

std::string paramkit::EnumParam::enumName
protected

Definition at line 572 of file param.h.

◆ enumToInfo

std::map<int, std::string> paramkit::EnumParam::enumToInfo
protected

required: info about the enum parameter

Definition at line 570 of file param.h.

◆ enumToString

std::map<int, std::string> paramkit::EnumParam::enumToString
protected

optional: string representation of the enum parameter

Definition at line 569 of file param.h.

◆ m_isSet

bool paramkit::EnumParam::m_isSet
protected

Definition at line 573 of file param.h.

◆ value

int paramkit::EnumParam::value

Definition at line 526 of file param.h.


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