MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / AddArg

Method AddArg

src/core/cmdlineparser.cpp:52–75  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// AddArg //////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

50// AddArg
51///////////////////////////////////////////////////////////////////////////////
52void cCmdLineParser::AddArg(
53 int argId, const TSTRING& arg, const TSTRING& alias, ParamCount numParams, bool multipleAllowed)
54{
55 if (arg.empty() && alias.empty())
56 {
57 // this refers to the list of parameters that comes after all the cmd line switches
58 mLastArgInfo.mId = argId;
59 mLastArgInfo.mNumParams = numParams;
60 return;
61 }
62
63 if (!arg.empty())
64 mArgTable.Insert(arg, cArgInfo(argId, numParams));
65 if (!alias.empty())
66 {
67 // put the alias in the table with a '-' prepended to it so it matches '--'
68 TSTRING str(_T("-"));
69 str += alias;
70 mArgTable.Insert(str, cArgInfo(argId, numParams));
71 }
72 // This argument can appear more than once on the command line.
73 if (multipleAllowed)
74 mMultipleAllowed.insert(argId);
75}
76
77///////////////////////////////////////////////////////////////////////////////
78// Clear

Callers 8

InitCmdLineCommonMethod · 0.80
InitCmdLineParserMethod · 0.80
InitCmdLineCommonFunction · 0.80
InitCmdLineParserMethod · 0.80
InitCmdLineParserMethod · 0.80
InitCmdLineCommonFunction · 0.80
InitCmdLineParserMethod · 0.80
TestCmdLineParserFunction · 0.80

Calls 3

cArgInfoClass · 0.85
emptyMethod · 0.80
InsertMethod · 0.45

Tested by 1

TestCmdLineParserFunction · 0.64