31 HPipe * hStdinWritePipe,
32 HPipe * hStdoutReadPipe,
33 HPipe * hStderrReadPipe = NULL,
34 bool closeStdinIfStdinWritePipeIsNull = true
50 bool closeStdinIfStdinStrEmpty = true
57 bool closeStdinIfStdinStrEmpty = true
81 Mixed const & desiredParams,
82 Mixed const & desiredOptions,
83 Mixed const & desiredFlags,
84 Mixed const & optionSymbols =
"=,:" 96 Mixed const &
getParam(
String const & name,
Mixed const & defValue =
"" )
const {
return this->hasParam(name) ? _params[name] : defValue; }
97 Mixed const &
getOption(
String const & name,
Mixed const & defValue =
"" )
const {
return this->hasOption(name) ? _options[name] : defValue; }
101 int getParamIndexInArgv(
String const & name )
const {
return _paramIndexesInArgv.find(name) != _paramIndexesInArgv.end() ? _paramIndexesInArgv.at(name) : -1; }
102 int getOptionIndexInArgv(
String const & name )
const {
return _optionIndexesInArgv.find(name) != _optionIndexesInArgv.end() ? _optionIndexesInArgv.at(name) : -1; }
103 int getFlagIndexInArgv(
String const & name )
const {
return _flagIndexesInArgv.find(name) != _flagIndexesInArgv.end() ? _flagIndexesInArgv.at(name) : -1; }
104 int getValueIndexInArgv(
String const & value )
const {
return _valueIndexesInArgv.find(value) != _valueIndexesInArgv.end() ? _valueIndexesInArgv.at(value) : -1; }
112 char const **
getArgv()
const {
return _argv; }
114 static void __MixedAppendToStringArray(
Mixed const & mx,
StringArray * arr );
124 std::map< String, int > _paramIndexesInArgv;
126 std::map< String, int > _optionIndexesInArgv;
128 std::map< String, int > _flagIndexesInArgv;
130 std::map< String, int > _valueIndexesInArgv;
154 bool hasValue(
String const & value )
const {
return std::find( _values.begin(), _values.end(), value ) != _values.end(); }
155 bool hasFlag(
String const & name )
const {
return std::find( _flags.begin(), _flags.end(), name ) != _flags.end(); }
168 virtual bool tryLock() = 0;
169 virtual bool lock() = 0;
170 virtual bool unlock() = 0;
197 virtual bool tryLock();
199 virtual bool unlock();
211 DllLoader_FuncNotFound = 0x00000100,
212 DllLoader_ModuleNoLoaded
231 static String GetModulePath(
void * funcInModule );
238 operator bool()
const {
return _hDllModule != NULL; }
239 operator ModuleHandle()
const {
return _hDllModule; }
242 char const * errStr()
const;
245 template <
typename _PfnType >
257 operator bool()
const {
return _pfn != NULL; }
260 void *
get()
const {
return reinterpret_cast<void *
>(_pfn); }
262 template <
typename... _ArgType >
263 typename winux::FuncTraits<PfnType>::ReturnType
call( _ArgType&& ... arg )
266 return (*_pfn)( std::forward<_ArgType>(arg)... );
274 template <
typename _PfnType >
277 _PfnType pfn = (_PfnType)this->funcAddr(funcName);
283 ModuleHandle _hDllModule;
291 #endif // __SYSTEM_HPP__
bool hasValue(String const &value) const
int getValueIndexInArgv(String const &value) const
int ExecCommand(winux::String const &cmd, winux::String const &stdinStr, winux::String *stdoutStr, winux::String *stderrStr=NULL, bool closeStdinIfStdinStrEmpty=true)
新建子进程执行指定命令,等待子进程结束,并把字符串重定向了标准设备
winux::String dllModuleFile
Dll模块文件
ScopeGuard(ILockObj &lockObj)
int getFlagIndexInArgv(String const &name) const
std::basic_string< char > AnsiString
int getValueCount() const
Mixed const & getParam(String const &name, Mixed const &defValue="") const
bool hasParam(String const &name) const
bool hasFlag(String const &name) const
Function< _PfnType > func(AnsiString const &funcName)
获取指定名字的Function对象,失败抛异常
winux::String GetExec(winux::String const &cmd, winux::String const &stdinStr="", winux::String *stderrStr=NULL, bool closeStdinIfStdinStrEmpty=true)
String getParam(String const &name, String const &defValue="") const
int getParamIndexInArgv(String const &name) const
int getOptionsCount() const
bool hasValue(String const &value) const
std::map< String, String > StringStringMap
int getValuesCount() const
DllLoaderError(int errType, AnsiString const &errStr)
bool hasFlag(String const &name) const
Mixed const & getOption(String const &name, Mixed const &defValue="") const
#define DISABLE_OBJECT_COPY(clsname)
std::vector< String > StringArray
int getOptionIndexInArgv(String const &name) const
int getFlagsCount() const
Function(AnsiString const &funcName, PfnType pfn)
int getParamsCount() const
String getValue(int i) const
bool isset(_MAP const &m, _KEY const &k)
检测map中是否有该键的值
bool hasParam(String const &name) const
int CommandLineToArgv(winux::String const &cmd, winux::StringArray *argv)
把命令行解析成Argv数组
String getFlag(int i) const
#define WINUX_FUNC_DECL(ret)
int getParamCount() const
Mixed const & getValue(int i) const
HProcess ExecCommandEx(winux::String const &cmd, HPipe *hStdinWritePipe, HPipe *hStdoutReadPipe, HPipe *hStderrReadPipe=NULL, bool closeStdinIfStdinWritePipeIsNull=true)
新建子进程执行指定命令,并用管道重定向了标准设备
bool hasOption(String const &name) const
winux::FuncTraits< PfnType >::ReturnType call(_ArgType &&...arg)
std::basic_string< tchar > String
Mixed const & getFlag(int i) const
void(*)() funcAddr(AnsiString const &funcName)
获取指定名字的函数地址
AnsiString const & getFuncName() const
char const ** getArgv() const