update CmdParse code
This commit is contained in:
parent
a3ef6866ae
commit
166868f21e
@ -16,7 +16,8 @@ namespace hgl
|
||||
public:
|
||||
|
||||
CmdParse(const OSStringList &);
|
||||
virtual ~CmdParse();
|
||||
CmdParse(const int,os_char **);
|
||||
virtual ~CmdParse()=default;
|
||||
|
||||
int Find(const OSString &)const; ///<查找一个指定字串开头的参数是否存在
|
||||
|
||||
|
@ -9,3 +9,16 @@ option(CM_UTIL_SUPPORT_JSON "Build JSON Parse/make module." ON)
|
||||
if(CM_UTIL_SUPPORT_JSON)
|
||||
add_subdirectory(json)
|
||||
endif(CM_UTIL_SUPPORT_JSON)
|
||||
|
||||
SET(CMD_SOURCE ${CMUTIL_ROOT_INCLUDE_PATH}/hgl/util/cmd/CmdParse.h
|
||||
cmd/CmdParse.cpp)
|
||||
|
||||
#SET(TIME_SOURCE ${CMUTIL_ROOT_INCLUDE_PATH}/hgl/util/time/Timer.h
|
||||
# time/Timer.cpp)
|
||||
|
||||
SOURCE_GROUP("Command Line" FILES ${CMD_SOURCE})
|
||||
#SOURCE_GROUP("Time" FILES ${TIME_SOURCE})
|
||||
|
||||
add_cm_library(CMUtil "CM/Util" ${CMD_SOURCE}
|
||||
# ${TIME_SOURCE}
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include<hgl/ut/CmdParse.h>
|
||||
#include<hgl/Str.h>
|
||||
#include<hgl/util/cmd/CmdParse.h>
|
||||
#include<hgl/type/StrChar.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
@ -10,8 +10,10 @@ namespace hgl
|
||||
args=_args;
|
||||
}
|
||||
|
||||
CmdParse::~CmdParse()
|
||||
CmdParse::CmdParse(const int argc,os_char **argv)
|
||||
{
|
||||
for(int i=0;i<argc;i++)
|
||||
args.Add(argv[i]);
|
||||
}
|
||||
|
||||
int CmdParse::Find(const OSString &flag)const
|
||||
|
Loading…
x
Reference in New Issue
Block a user