fastdo  0.5.12
winux::CommandLineVars类 参考

命令行变量解析器 更多...

#include <system.hpp>

Public 成员函数

 CommandLineVars (int argc, char const **argv, Mixed const &desiredParams, Mixed const &desiredOptions, Mixed const &desiredFlags, Mixed const &optionSymbols="=,:")
 构造函数 更多...
 
int getParamsCount () const
 
int getOptionsCount () const
 
int getFlagsCount () const
 
int getValuesCount () const
 
bool hasParam (String const &name) const
 
bool hasOption (String const &name) const
 
bool hasFlag (String const &name) const
 
bool hasValue (String const &value) const
 
Mixed const & getParam (String const &name, Mixed const &defValue="") const
 
Mixed const & getOption (String const &name, Mixed const &defValue="") const
 
Mixed const & getFlag (int i) const
 
Mixed const & getValue (int i) const
 
int getParamIndexInArgv (String const &name) const
 
int getOptionIndexInArgv (String const &name) const
 
int getFlagIndexInArgv (String const &name) const
 
int getValueIndexInArgv (String const &value) const
 
Mixed & getParams ()
 
Mixed & getOptions ()
 
Mixed & getFlags ()
 
Mixed & getValues ()
 
int getArgc () const
 
char const ** getArgv () const
 

详细描述

命令行变量解析器

该解析器定义了四种变量

  • 参数(Params):由‘前缀字符+名字’和‘下一个命令行值’组成。例如:/file abc.cpp
  • 选项(Options):由‘前缀字符+名字’‘= or :’‘选项值’组成。例如: –std=c99 /Fo:abc_dir
  • 旗标(Flags):由‘前缀字符+名字’组成。例如:–exe –cpp /DLL
  • 值:剩余未能识别的都被当成值

在文件 system.hpp 第 67 行定义.

构造及析构函数说明

winux::CommandLineVars::CommandLineVars ( int  argc,
char const **  argv,
Mixed const &  desiredParams,
Mixed const &  desiredOptions,
Mixed const &  desiredFlags,
Mixed const &  optionSymbols = "=,:" 
)

构造函数

参数
[in]argc命令行参数个数,可由main()参数传入
[in]argv命令行参数,可由main()参数传入
[in]desiredParams要识别的参数名(逗号分割的String类型、或者Array类型)
[in]desiredOptions要识别的选项名(逗号分割的String类型、或者Array类型)
[in]desiredFlags要识别的旗标名(逗号分割的String类型、或者Array类型)
[in]optionSymbols选项赋值符号(逗号分割的String类型、或者Array类型)。默认是'='和':'

成员函数说明

int winux::CommandLineVars::getArgc ( ) const
inline

在文件 system.hpp 第 111 行定义.

char const** winux::CommandLineVars::getArgv ( ) const
inline

在文件 system.hpp 第 112 行定义.

Mixed const& winux::CommandLineVars::getFlag ( int  i) const
inline

在文件 system.hpp 第 98 行定义.

int winux::CommandLineVars::getFlagIndexInArgv ( String const &  name) const
inline

在文件 system.hpp 第 103 行定义.

Mixed& winux::CommandLineVars::getFlags ( )
inline

在文件 system.hpp 第 108 行定义.

int winux::CommandLineVars::getFlagsCount ( ) const
inline

在文件 system.hpp 第 88 行定义.

Mixed const& winux::CommandLineVars::getOption ( String const &  name,
Mixed const &  defValue = "" 
) const
inline

在文件 system.hpp 第 97 行定义.

int winux::CommandLineVars::getOptionIndexInArgv ( String const &  name) const
inline

在文件 system.hpp 第 102 行定义.

Mixed& winux::CommandLineVars::getOptions ( )
inline

在文件 system.hpp 第 107 行定义.

int winux::CommandLineVars::getOptionsCount ( ) const
inline

在文件 system.hpp 第 87 行定义.

Mixed const& winux::CommandLineVars::getParam ( String const &  name,
Mixed const &  defValue = "" 
) const
inline

在文件 system.hpp 第 96 行定义.

int winux::CommandLineVars::getParamIndexInArgv ( String const &  name) const
inline

在文件 system.hpp 第 101 行定义.

Mixed& winux::CommandLineVars::getParams ( )
inline

在文件 system.hpp 第 106 行定义.

int winux::CommandLineVars::getParamsCount ( ) const
inline

在文件 system.hpp 第 86 行定义.

Mixed const& winux::CommandLineVars::getValue ( int  i) const
inline

在文件 system.hpp 第 99 行定义.

int winux::CommandLineVars::getValueIndexInArgv ( String const &  value) const
inline

在文件 system.hpp 第 104 行定义.

Mixed& winux::CommandLineVars::getValues ( )
inline

在文件 system.hpp 第 109 行定义.

int winux::CommandLineVars::getValuesCount ( ) const
inline

在文件 system.hpp 第 89 行定义.

bool winux::CommandLineVars::hasFlag ( String const &  name) const
inline

在文件 system.hpp 第 93 行定义.

bool winux::CommandLineVars::hasOption ( String const &  name) const
inline

在文件 system.hpp 第 92 行定义.

bool winux::CommandLineVars::hasParam ( String const &  name) const
inline

在文件 system.hpp 第 91 行定义.

bool winux::CommandLineVars::hasValue ( String const &  value) const
inline

在文件 system.hpp 第 94 行定义.


该类的文档由以下文件生成: