fastdo  0.6.16
winux::CommandLineVars类 参考

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

#include <system.hpp>

Public 成员函数

 CommandLineVars (int argc, winux::tchar const **argv, Mixed const &desiredParams, Mixed const &desiredOptions, Mixed const &desiredFlags, Mixed const &optionSymbols=$T("=,:"))
 构造函数 更多...
 
size_t getParamsCount () const
 获取参数个数 更多...
 
size_t getOptionsCount () const
 获取选项个数 更多...
 
size_t getFlagsCount () const
 获取旗标个数 更多...
 
size_t 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=$T("")) const
 获取指定名字的参数 更多...
 
Mixed const & getOption (String const &name, Mixed const &defValue=$T("")) const
 获取指定名字的选项 更多...
 
Mixed const & getFlag (size_t i) const
 获取指定索引的旗标 更多...
 
Mixed const & getValue (size_t i) const
 获取指定索引的值 更多...
 
size_t getParamIndexInArgv (String const &name) const
 获取指定参数在argv中的索引 更多...
 
size_t getOptionIndexInArgv (String const &name) const
 获取指定选项在argv中的索引 更多...
 
size_t getFlagIndexInArgv (String const &name) const
 获取指定旗标在argv中的索引 更多...
 
size_t getValueIndexInArgv (String const &value) const
 获取指定值在argv中的索引 更多...
 
Mixed & getParams ()
 获取全部参数 更多...
 
Mixed & getOptions ()
 获取全部选项 更多...
 
Mixed & getFlags ()
 获取全部旗标 更多...
 
Mixed & getValues ()
 获取全部值 更多...
 
Mixed dump () const
 倾泻全部 更多...
 
int getArgc () const
 获取argc 更多...
 
winux::tchar const ** getArgv () const
 获取argv 更多...
 

详细描述

命令行变量解析器

该解析器定义了四种变量

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

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

构造及析构函数说明

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

构造函数

参数
[in]argc命令行参数个数,可由main()参数传入
[in]argv命令行参数,可由main()参数传入
[in]desiredParams要识别的参数名(逗号分割的String类型、或者Array类型)
[in]desiredOptions要识别的选项名(逗号分割的String类型、或者Array类型)
[in]desiredFlags要识别的旗标名(逗号分割的String类型、或者Array类型)。如果要识别的旗标名是单个字符(不含前缀),则命令行中可以一个参数指定多个旗标。以最先出现在要识别的单字符旗标名的前缀为参数前缀。
[in]optionSymbols选项赋值符号(逗号分割的String类型、或者Array类型)。默认是'='和':'

成员函数说明

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

获取参数个数

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

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

获取选项个数

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

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

获取旗标个数

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

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

获取值个数

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

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

是否有此参数

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

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

是否有此选项

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

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

是否有此旗标

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

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

是否有此值

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

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

获取指定名字的参数

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

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

获取指定名字的选项

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

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

获取指定索引的旗标

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

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

获取指定索引的值

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

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

获取指定参数在argv中的索引

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

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

获取指定选项在argv中的索引

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

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

获取指定旗标在argv中的索引

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

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

获取指定值在argv中的索引

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

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

获取全部参数

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

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

获取全部选项

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

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

获取全部旗标

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

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

获取全部值

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

Mixed winux::CommandLineVars::dump ( ) const
inline

倾泻全部

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

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

获取argc

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

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

获取argv

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


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