4 ArgV(), HdStr(), MnArgs(1), SilentP(false), Notify(_Notify) {
5 for (
int ArgN = 0; ArgN < _Args; ArgN++)
10 ArgV(), HdStr(), MnArgs(1), SilentP(false), Notify(_Notify) {
24 for (
int ArgN=FromArgN; ArgN<
GetArgs(); ArgN++){
25 if (ArgN>FromArgN){CmLnChA+=
' ';}
34 if (
GetArg(ArgN).GetSubStr(0, PrefixStr.
Len()-1)==PrefixStr){
return ArgN;}
58 TStr DateStr=__DATE__;
61 for (
int ChN=0; ChN<
HdStr.
Len()+DateStr.
Len()+3; ChN++){printf(
"=");}
67 printf(
"usage: %s\n", ExeFNm.
CStr());
76 printf(
"========================================\n");
78 for (
int ChN=0; ChN<
HdStr.
Len(); ChN++){printf(
"=");}
89 if (
GetArg(ArgN)==ArgStr){
return true;}
99 printf(
" %s %s \n", ArgStr.
CStr(), DNm.
CStr());}
104 TStr MsgStr=DNm+
" ("+ArgStr+(Val?
")=YES":
")=NO");
111 const TStr& PrefixStr,
const TStr& DfVal,
const TStr& DNm)
const {
115 printf(
" %s%s (default:'%s')\n", PrefixStr.
CStr(), DNm.
CStr(), DfVal.
CStr());}
123 if ((Val[0]==
'\"')&&(Val.
LastCh()==
'\"')){
130 TStr MsgStr=DNm+
" ("+PrefixStr+
")="+Val;
137 const TStr& PrefixStr,
TStrV& DfValV,
const TStr& DNm)
const {
142 printf(
" %s%s (default:", PrefixStr.
CStr(), DNm.
CStr());
143 for (
int DfValN=0; DfValN<DfValV.
Len(); DfValN++){
144 if (DfValN>0){printf(
", ");}
145 printf(
"'%s'", DfValV[DfValN].CStr());
153 for (
int ArgN=0; ArgN<
GetArgs(); ArgN++){
161 if (ArgValV.
Len()>1){ArgValVChA+=
", ";}
162 ArgValVChA+=ArgValV.
Last();
165 if (ArgValV.
Empty()){ArgValV=DfValV;}
168 MsgChA+=DNm; MsgChA+=
" ("; MsgChA+=PrefixStr; MsgChA+=
")=";
169 for (
int ArgValN=0; ArgValN<ArgValV.
Len(); ArgValN++){
170 if (ArgValN>0){MsgChA+=
", ";}
171 MsgChA+=
"'"; MsgChA+=ArgValV[ArgValN]; MsgChA+=
"'";
179 const TStr& PrefixStr,
const bool& DfVal,
const TStr& DNm)
const {
183 printf(
" %s%s (default:'%s')\n",
189 if ((PrefixStr.
Len()>0)&&(PrefixStr.
LastCh()==
':')){
196 TStr RedPrefixStr=PrefixStr;
210 const TStr& PrefixStr,
const int& DfVal,
const TStr& DNm)
const {
214 printf(
" %s%s (default:%d)\n", PrefixStr.
CStr(), DNm.
CStr(), DfVal);}
232 const TStr& PrefixStr,
TIntV& DfValV,
const TStr& DNm)
const {
235 for (
int ValN=0; ValN<DfValV.
Len(); ValN++){
241 for (
int ValN=0; ValN<ValStrV.
Len(); ValN++){
243 if (ValStrV[ValN].IsInt(Val)){
251 const TStr& PrefixStr,
const double& DfVal,
const TStr& DNm)
const {
255 printf(
" %s%s (default:%g)\n", PrefixStr.
CStr(), DNm.
CStr(), DfVal);}
273 VarNmV.
Clr();
int VarN=0;
274 while (_environ[VarN]!=NULL){
275 TStr VarNmVal=_environ[VarN++];
282 VarNmValV.
Clr();
int VarN=0;
283 while (_environ[VarN]!=NULL){
284 VarNmValV.
Add(_environ[VarN++]);
289 const int RetVal = putenv(
TStr::Fmt(
"%s=%s", VarNm.
CStr(), VarVal.
CStr()).CStr());
int GetIfArgPrefixInt(const TStr &PrefixStr, const int &DfVal=0, const TStr &DNm="") const
void GetVarNmV(TStrV &VarNmV)
TStr GetIfArgPrefixStr(const TStr &PrefixStr, const TStr &DfVal="", const TStr &DNm="") const
bool IsPrefix(const char *Str) const
TSizeTy Len() const
Returns the number of elements in the vector.
static TStr GetYesNoStr(const bool &Val)
TStr GetSubStr(const int &BChN, const int &EChN) const
void GetVarNmValV(TStrV &NmValV)
TIntV GetIfArgPrefixIntV(const TStr &PrefixStr, TIntV &DfValV, const TStr &DNm="") const
int GetPrefixArgN(const TStr &PrefixStr) const
static bool GetValFromStr(const TStr &Str)
TStr GetCmLn(const int &FromArgN=1) const
bool Empty() const
Tests whether the vector is empty.
void SplitOnCh(TStr &LStr, const char &SplitCh, TStr &RStr) const
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
TStrV GetIfArgPrefixStrV(const TStr &PrefixStr, TStrV &DfValV, const TStr &DNm="") const
bool IsArgStr(const TStr &ArgStr)
double GetIfArgPrefixFlt(const TStr &PrefixStr, const double &DfVal=0, const TStr &DNm="") const
bool IsArgPrefix(const TStr &PrefixStr) const
const TVal & Last() const
Returns a reference to the last element of the vector.
void PrepArgs(const TStr &_HdStr=TStr(), const int &_MnArgs=1, const bool &SilentP=false)
bool GetIfArgPrefixBool(const TStr &PrefixStr, const bool &DfVal=false, const TStr &DNm="") const
void DelSubStr(const int &BChN, const int &EChN)
TStr GetArgPostfix(const TStr &PrefixStr) const
TStr GetVarVal(const TStr &VarNm) const
virtual void OnStatus(const TStr &)
static TStr Fmt(const char *FmtStr,...)
static void PutVarVal(const TStr &VarNm, const TStr &VarVal)
void SplitOnAllCh(const char &SplitCh, TStrV &StrV, const bool &SkipEmpty=true) const
static TStr GetStr(const bool &Val)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
TStr GetArg(const int &ArgN) const