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

A parameter storing an integer value. More...

#include <param.h>

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

Public Types

enum  t_int_base { INT_BASE_ANY = 0 , INT_BASE_DEC = 1 , INT_BASE_HEX = 2 , INT_BASE_COUNT }
 

Public Member Functions

 IntParam (const std::string &_argStr, bool _isRequired, t_int_base _base=INT_BASE_ANY)
 
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 parse (const char *arg)
 Parses the parameter from the given string. More...
 
bool isValidNumber (const char *arg, const size_t len)
 
- 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

t_int_base base
 
uint64_t value
 

Additional Inherited Members

- 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...
 
virtual bool isKeywordInType (const std::string &keyword)
 Checks if the parameter type contains the keyword. More...
 
virtual bool isKeywordInDescription (const std::string &keyword)
 Checks if the description contains the keyword. More...
 
virtual std::string extendedInfo () const
 Extended information. More...
 
- 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 integer value.

Definition at line 188 of file param.h.

Member Enumeration Documentation

◆ t_int_base

Enumerator
INT_BASE_ANY 
INT_BASE_DEC 
INT_BASE_HEX 
INT_BASE_COUNT 

Definition at line 191 of file param.h.

Constructor & Destructor Documentation

◆ IntParam()

paramkit::IntParam::IntParam ( const std::string &  _argStr,
bool  _isRequired,
t_int_base  _base = INT_BASE_ANY 
)
inline

Definition at line 199 of file param.h.

Member Function Documentation

◆ isSet()

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

Returns true if the parameter is filled, false otherwise.

Implements paramkit::Param.

Definition at line 230 of file param.h.

◆ isValidNumber()

bool paramkit::IntParam::isValidNumber ( const char *  arg,
const size_t  len 
)
inline

Definition at line 253 of file param.h.

Here is the call graph for this function:

◆ parse()

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

Parses the parameter from the given string.

Implements paramkit::Param.

Definition at line 235 of file param.h.

Here is the call graph for this function:

◆ type()

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

Returns the string representation of the parameter's type.

Implements paramkit::Param.

Definition at line 220 of file param.h.

◆ valToString()

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

Returns the string representation of the parameter's value.

Implements paramkit::Param.

Definition at line 207 of file param.h.

Member Data Documentation

◆ base

t_int_base paramkit::IntParam::base

Definition at line 271 of file param.h.

◆ value

uint64_t paramkit::IntParam::value

Definition at line 272 of file param.h.


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