&
GetName(
void)
const{
returnm_Name; }
211 virtual const string&
AsString(
void)
const= 0;
266fTruncate = (1 << 12),
268fCreatePath = (1 << 8)
327fArgValue_HasDefault = (1 << 0),
328fArgValue_FromDefault = (1 << 1)
366 voidx_SetDefault(
const string& def_value,
boolfrom_def);
428 boolExist(
const string& name)
const;
442 const CArgValue& operator[] (
const string& name)
const;
448 const CArgValue& operator[] (
size_tidx)
const;
451vector< CRef<CArgValue> > GetAll(
void)
const;
454 string&
Print(
string&
str)
const;
474 boolupdate =
false,
475 booladd_value =
false);
478 boolIsEmpty(
void)
const;
481 voidRemove(
const string& name);
512 TArgsCIx_Find(
const string& name)
const;
513 TArgsIx_Find(
const string& name);
541 const string&
value)
const;
590 voidSetArgsType(EArgSetType args_type);
601ePositionalMode_Loose
606{ m_PositionalMode = positional_mode; }
631 static const char* GetTypeName(EType
type);
647fTruncate = (1 << 12),
651fCreatePath = (1 << 8),
654fFileFlags = fPreOpen | fBinary | fAppend | fTruncate |
fNoCreate| fCreatePath,
658fAllowMultiple = (1 << 3),
664fIgnoreInvalidValue = (1 << 4),
667fWarnOnInvalidValue = (1 << 5),
676fOptionalSeparator = (1 << 6),
679fOptionalSeparatorAllowConflict = (1 << 9),
682fMandatorySeparator = (1 << 7),
697fConfidential = (1 << 13),
700fStandard = (1 << 14)
718 voidAddKey(
const string& name,
719 const string& synopsis,
720 const string& comment,
739 voidAddOptionalKey(
const string& name,
740 const string& synopsis,
741 const string& comment,
760 voidAddDefaultKey(
const string& name,
761 const string& synopsis,
762 const string& comment,
764 const string& default_value,
770 const char* display_value =
nullptr 776eFlagHasValueIfMissed = 0,
777eFlagHasValueIfSet = 1
795 voidAddFlag(
const string& name,
796 const string& comment,
818 voidAddOpening(
const string& name,
819 const string& comment,
843 voidAddPositional(
const string& name,
844 const string& comment,
866 voidAddOptionalPositional(
const string& name,
867 const string& comment,
887 voidAddDefaultPositional(
const string& name,
888 const string& comment,
890 const string& default_value,
896 const char* display_value =
nullptr 911 voidAddExtra(
unsignedn_mandatory,
913 const string& comment,
931 voidAddAlias(
const string& alias,
const string& arg_name);
939 voidAddNegatedFlagAlias(
const string& alias,
940 const string& arg_name,
976 voidSetConstraint(
const string& name,
978EConstraintNegate negate = eConstraint);
982 voidSetConstraint(
const string& name,
984EConstraintNegate negate = eConstraint);
997 voidSetDependency(
const string& arg1,
999 const string& arg2);
1005 voidSetCurrentGroup(
const string& group);
1017 voidSetErrorHandler(
const string& name,
1021 boolExist(
const string& name)
const;
1028 voidDelete(
const string& name);
1034 voidSetUsageContext(
const string& usage_name,
1035 const string& usage_description,
1036 boolusage_sort_args =
false,
1049 voidSetDetailedDescription(
const string& usage_description);
1061fUsageIfNoArgs = 1 << 1,
1063fUsageSortArgs = 1 << 2,
1064fDupErrToCerr = 1 << 3,
1073m_MiscFlags |=
flags;
1079m_MiscFlags &= ~
flags;
1085 return(m_MiscFlags & flag) != 0;
1096fHideLogfile = 0x01,
1097fHideConffile = 0x02,
1098fHideVersion = 0x04,
1099fHideFullVersion = 0x08,
1102fHideFullHelp = 0x40,
1103fHideXmlHelp = 0x80,
1114 virtual string& PrintUsage(
string&
str,
booldetailed =
false)
const;
1128 static boolVerifyName(
const string& name,
boolextended =
false);
1140 virtual voidAddStdArguments(THideStdArgs
mask);
1142 voidAddDefaultFileArguments(
const string& default_config);
1156: m_Arg(arg), m_Dep(dep) {}
1197 boolnegated=
false)
const;
1233 const string& arg2,
1241 const string& name,
1243 const string& arg2,
1244 unsigned intn_plain,
1246 boolupdate =
false,
1256 unsigned intn_plain,
1275 voidAddSynopsis(list<string>&
arr,
const string& intro,
const string& prefix)
const;
1276 voidAddDescription(list<string>&
arr,
booldetailed)
const;
1277 voidAddCommandDescription(list<string>&
arr,
const string&
cmd,
1279 voidAddDetails(list<string>&
arr)
const;
1310 template<
classTSize,
classTArray>
1317unique_ptr<CArgs> args(
new CArgs());
1320 if(GetArgsType() == eCgiArgs && argc == 2) {
1321x_CheckAutoHelp(argv[1]);
1322 returnargs.release();
1327 for(TSize
i= 1;
i< argc;
i++) {
1328 boolhave_arg2 = (
i+ 1 < argc);
1329 if( x_CreateArg(argv[
i], have_arg2,
1330have_arg2 ? (
string) argv[
i+1] :
kEmptyStr,
1331&n_plain, *args) ) {
1342x_PostCheck(*args, n_plain, eCreateArgs);
1343 returnargs.release();
1359 const string& param_name = *it;
1362 typenameT::const_iterator vit = arg_map.find(param_name);
1363 typenameT::const_iterator vend = arg_map.end();
1367x_CreateArg(param_name, param_name,
1375 if(new_arg_value && x_IsMultiArg(param_name)) {
1380 for(++vit; vit != vend; ++vit) {
1381 if(vit->first != param_name)
1383varr.push_back(vit->second);
1390x_PostCheck(*args, 0, eConvertKeys);
1394 returnlist<CArgDescriptions*>({
this});
1417eCommandMandatory = 0,
1418eCommandOptional = 1,
1419eNoSortCommands = (1<<1),
1420eNoSortGroups = (1<<2)
1439 voidSetCurrentCommandGroup(
const string& group);
1462 virtual voidAddStdArguments(THideStdArgs
mask);
1470 virtual string& PrintUsage(
string&
str,
booldetailed =
false)
const;
1478 virtuallist<CArgDescriptions*> GetAllDescriptions(
void);
1484 boolx_IsCommandMandatory(
void)
const;
1485 size_tx_GetCommandGroupIndex(
const string& group)
const;
1486 stringx_IdentifyCommand(
const string&
command)
const;
1541 virtual CArgAllow* Clone(
void)
const;
1600 virtual boolVerify(
const string&
value)
const;
1603 virtual stringGetUsage(
void)
const;
1610 virtual CArgAllow* Clone(
void)
const;
1642 virtual boolVerify(
const string&
value)
const;
1645 virtual stringGetUsage(
void)
const;
1652 virtual CArgAllow* Clone(
void)
const;
1703 returnAllowValue(
value);
1708 virtual boolVerify(
const string&
value)
const;
1711 virtual stringGetUsage(
void)
const;
1716 virtual CArgAllow* Clone(
void)
const;
1752 virtual boolVerify(
const string&
value)
const;
1755 virtual stringGetUsage(
void)
const;
1762 virtual CArgAllow* Clone(
void)
const;
1792 virtual stringGetUsage(
void)
const;
1796 virtual CArgAllow* Clone(
void)
const;
1827 virtual boolVerify(
const string&
value)
const;
1830 virtual stringGetUsage(
void)
const;
1837 virtual CArgAllow* Clone(
void)
const;
1861 const string& comment,
1869 const string&
GetName(
void)
const{
returnm_Name; }
1892 virtual voidVerifyDefault (
void)
const;
1900 voidSetConstraint(
const CArgAllow* constraint,
1909 virtual const CArgAllow* GetConstraint(
void)
const;
1912 stringGetUsageConstraint(
void)
const;
1943 const string& name,
const string& description =
kEmptyStr);
1982EInstantSet instant_set = eNoInstantSet);
1993EInstantSet instant_set = eNoInstantSet);
1996 boolx_Evaluate(
const CArgs& args,
string* arg_set,
string* arg_unset)
const;
2010 voidPrintUsage(list<string>&
arr,
size_t offset)
const;
2012 voidEvaluate(
const CArgs& args)
const;
ncbi::TMaskedQueryRegions mask
Template used to replace bool type arguments with some strict equivalent.
CCommandArgDescriptions â.
container_type::const_iterator const_iterator
parent_type::iterator iterator
parent_type::const_iterator const_iterator
void Print(const CCompactSAMApplication::AlignInfo &ai)
static vector< string > arr
std::ofstream out("events_result.xml")
main entry point for tests
static int err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
static const char * str(char *buf, int n)
#define NCBI_DEPRECATED_CTOR(decl)
Macro used to mark a constructor as deprecated.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
virtual list< CArgDescriptions * > GetAllDescriptions(void)
EFlags
Additional flags, the first group is file related flags.
size_t GetOrdinalPosition(void) const
Get ordinal position of the value.
unsigned int TCommandArgFlags
Bitwise OR of ECommandArgFlags.
TArgs::const_iterator TArgsCI
Type for const iterator.
virtual bool AsBoolean(void) const =0
Get the argument's boolean value.
TArgGroups m_ArgGroups
Argument groups.
virtual CArgValue * ProcessDefault(void) const =0
Process argument default.
CArgs * CreateArgs(TSize argc, TArray argv) const
Create parsed arguments in CArgs object.
CArgDescriptions::TFlags GetFlags(void) const
Get argument flags.
void x_CheckAutoHelp(const string &arg) const
Helper method for checking if auto help requested and throw CArgHelpException if help requested.
map< string, EInstantSet > m_Arguments
TArgsI x_Find(const string &name, bool *negative=NULL)
Helper method to find named parameter.
set< string, PNocase_Conditional > TStrings
Type of the container that contains the allowed string values.
string m_Name
Argument name.
virtual const string & AsString(void) const =0
Get the argument's string value.
list< const CArgDesc * > m_args
virtual double AsDouble(void) const =0
Get the argument's double value.
void x_PrintAliasesAsXml(CNcbiOstream &out, const string &name, bool negated=false) const
string m_Command
current command
map< CConstRef< CArgDependencyGroup >, EInstantSet > m_Groups
TArgs m_Args
Assoc.map of arguments' name/descr.
string m_Name
Argument name.
CRef< CArgErrorHandler > m_ErrorHandler
Global error handler or NULL.
size_t x_GetGroupIndex(const string &group) const
Get group index.
const string & GetName(void) const
Get argument name.
virtual string GetUsageSynopsis(bool name_only=false) const =0
Get usage synopsis.
TPosArgs m_OpeningArgs
Opening args, ordered by position in cmd.-line.
CArgDependencyGroup(const CArgDependencyGroup &dep_group)
set< AutoPtr< CArgDesc > > TArgs
Argument descr. type.
set< CRef< CArgValue > > TArgs
Type for arguments.
EMiscFlags
Miscellaneous flags.
void SetMiscFlags(TMiscFlags flags)
Set the selected flags.
SIZE_TYPE m_UsageWidth
Maximum length of a usage line.
multimap< string, SArgDependency > TDependencies
virtual const CDir & AsDirectory(void) const =0
Get the argument as a directory.
void SetArgsType(EArgSetType)
bool IsAutoHelpEnabled(void) const
See if special flag "-h" is activated.
TStrings m_Strings
Set of allowed string values.
list< string > m_CmdGroups
group names, and order
virtual const CArgErrorHandler * GetErrorHandler(void) const
Get error handler for the argument.
size_t IsStandard(void) const
Checks that this is a standard/special argument.
string m_Comment
Argument description.
TDependencies::const_iterator TDependency_CI
bool operator<(const CRef< CArgValue > &x, const CRef< CArgValue > &y)
virtual void SetErrorHandler(CArgErrorHandler *)
Set error handler for the argument.
void SetPositionalMode(EArgPositionalMode positional_mode)
Select mode for processing positional arguments.
virtual bool IsConstraintInverted() const
Returns TRUE if associated constraint is inverted (NOT)
unsigned int TFileFlags
Bitwise OR of "EFileFlags".
EErrCode
Error types for improperly formatted arguments.
vector< string > TArgGroups
Argument groups.
void x_PreCheck(void) const
Helper method for doing pre-processing consistency checks.
EArgSetType GetArgsType() const
virtual CNcbiIostream & AsIOFile(TFileFlags flags=0) const =0
Get the argument as a file stream.
virtual string GetUsage(void) const =0
Get usage information.
CArgAllow_Strings & operator,(const string &value)
Short notation operator for adding allowed string values.
EArgPositionalMode GetPositionalMode() const
void x_PrintComment(list< string > &arr, const CArgDesc &arg, SIZE_TYPE width) const
CArgs * SetCommand(const string &command)
Set current command.
virtual CNcbiIstream & AsInputFile(TFileFlags flags=0) const =0
Get the argument as an input file stream.
TArgs::iterator TArgsI
Type for iterator.
bool x_CreateArg(const string &arg1, bool have_arg2, const string &arg2, unsigned *n_plain, CArgs &args) const
Process arguments.
void ResetMiscFlags(TMiscFlags flags)
Clear the selected usage flags.
virtual string GetUsageCommentAttr(void) const =0
Get usage comment attribute.
string m_UsageName
Program name.
SArgDependency(const string arg, EDependency dep)
NCBI_EXCEPTION_DEFAULT(CArgException, CCoreException)
EArgSetType m_ArgsType
Type of arguments.
const string & GetName(void) const
Get argument name.
void SetOrdinalPosition(size_t pos)
set< TSymClass > m_SymClass
CArgDescriptions::TFlags m_Flags
string GetCommand(void) const
Get current command.
EArgValueFlags
Whether the argument:
size_t m_CurrentCmdGroup
current group #
pair< double, double > TInterval
set< CConstRef< CArgDependencyGroup > > m_DependencyGroups
virtual void SetGroup(size_t)
Set argument group.
map< string, AutoPtr< CArgDescriptions > > TDescriptions
virtual bool Verify(const string &value) const =0
Verify if specified value is allowed.
list< string > m_Commands
command names, and order
TArgs::iterator TArgsI
Arguments iterator.
EArgSetType
Type of CArgDescriptions For a CGI application positional arguments and flags does not make sense (th...
bool m_HasHidden
Has hidden arguments.
TDependencies m_Dependencies
Arguments' dependencies.
map< string, string > m_Aliases
command to alias; one alias only
virtual CNcbiOstream & AsOutputFile(TFileFlags flags=0) const =0
Get the argument as an output file stream.
unsigned int TFlags
Bitwise OR of "EFlags".
virtual bool HasValue(void) const =0
Check if argument holds a value.
DECLARE_OPERATOR_BOOL(HasValue())
Synonym for HasValue().
TArgs m_Args
Assoc. map of arguments' name/value.
size_t m_nExtra
Cached # of unnamed positional arguments.
void ConvertKeys(CArgs *args, const T &arg_map, bool update) const
Convert argument map (key-value pairs) into arguments in accordance with the argument descriptions.
set< TInterval > m_MinMax
EFlagValue
Define how flag presence affect CArgValue::HasValue().
list< string > TKeyFlagArgs
List of flag arguments.
virtual CArgValue * ProcessArgument(const string &value) const =0
Process argument with specified value.
EDependency
Dependencies between arguments.
void x_AddDesc(CArgDesc &arg)
Helper method for adding description.
virtual size_t GetGroup(void) const
Get argument group.
EInstantSet
Control whether the "setting" of this particular member marks the whole group as "set" regardless of ...
size_t m_CurrentGroup
Currently selected group (0 = no group)
virtual void CloseFile(void) const =0
Close the file.
string m_DetailedDescription
Program long description.
EType
Available argument types.
TMiscFlags m_MiscFlags
Flags for USAGE, error handling etc.
string m_UsageDescription
Program description.
TDescriptions m_Description
command to ArgDescriptions
virtual int AsInteger(void) const =0
Get the argument's integer value.
const string & GetComment(void) const
Get argument description.
EHideStdArgs
Which standard flag's descriptions should not be displayed in the usage message.
string m_NoSeparator
Arguments allowed to use no separator.
virtual TStringArray & SetStringList()
Get reference on value list for further modification.
int THideStdArgs
Binary OR of "EHideStdArgs".
unsigned int TArgValueFlags
Bitwise OR of "EArgValueFlags".
virtual const CTime & AsDateTime(void) const =0
Get the argument as a DateTime.
bool m_AutoHelp
Special flag "-h" activated.
EArgPositionalMode
Processing of positional arguments.
TArgs::const_iterator TArgsCI
Const arguments iterator.
pair< ESymbolClass, string > TSymClass
vector< string > TStringArray
Some values types can contain several value lists.
set< TInterval > m_MinMax
vector< string > TPosArgs
Positional arg. vector.
ESymbolClass
Symbol class for defining sets of characters.
const CArgDescriptions & m_desc
const CArgDescriptions & m_desc
EArgPositionalMode m_PositionalMode
Processing of positional args.
virtual Int8 AsInt8(void) const =0
Get the argument's integer (8-byte long) value.
unsigned m_nExtraOpt
> # of mandatory extra args
virtual TIntId AsIntId(void) const =0
Get the argument's value as an integer id (TIntId).
TKeyFlagArgs m_KeyFlagArgs
Key/flag args, in order of insertion.
EConstraintNegate
Flag to invert constraint logically.
size_t GetNExtra(void) const
Get the number of unnamed positional (a.k.a. extra) args.
map< string, size_t > m_Groups
command to group #
bool x_CreateArg(const string &arg1, const string &name, bool have_arg2, const string &arg2, unsigned int n_plain, CArgs &args, bool update=false, CArgValue **new_value=0) const
TPosArgs m_PosArgs
Pos. args, ordered by position in cmd.-line.
bool x_IsMultiArg(const string &name) const
Returns TRUE if parameter supports multiple arguments.
pair< Int8, Int8 > TInterval
int TMiscFlags
Bitwise OR of "EMiscFlags".
TCommandArgFlags m_Cmd_req
void x_PostCheck(CArgs &args, unsigned int n_plain, EPostCheckCaller caller) const
Helper method for doing post-processing consistency checks.
bool IsSetMiscFlag(EMiscFlags flag) const
Check if the flag is set.
NCBI_EXCEPTION_DEFAULT(CArgHelpException, CArgException)
@ eConvertKeys
called by ConvertKeys()
@ eCreateArgs
called by CreateArgs()
@ eHelpShowAll
Error code for detailed help message which includes hidden arguments.
@ eHelp
Error code for short help message.
@ eHelpXml
Error code for XML formatted help message.
@ eHelpFull
Error code for detailed help message.
@ eExcludedValue
The value is excluded by another argument.
@ eNoFile
Expecting a file.
@ eNoValue
Expecting an argument value.
@ eWrongCast
Incorrect cast for an argument.
@ eArgType
Wrong argument type.
@ eConvert
Conversion problem.
@ eConstraint
Argument value outside constraints.
@ eInvalidArg
Invalid argument.
@ eRegularArgs
Regular application.
@ eRequires
One argument requires another.
@ eInt8
Convertible into an integer number (Int8 only)
@ eInputFile
Name of file (must exist and be readable)
@ eBoolean
{'true', 't', 'false', 'f'}, case-insensitive
@ eDouble
Convertible into a floating point number (double)
@ eDataSize
Integer number with possible "software" qualifiers (KB, KiB, et al)
@ eIntId
Convertible to TIntId (int or Int8 depending on NCBI_INT8_GI)
@ eIOFile
Name of file (must be writable)
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
@ eDirectory
Name of file directory.
@ ePositionalMode_Strict
Strict mode (default)
@ eLower
Lowercase characters.
@ eAlnum
Alphanumeric characters.
@ eGraph
Graphical characters.
@ ePrint
Printable characters.
@ eSpace
Space characters.
@ eDigit
Digit characters.
@ eUpper
Uppercase characters.
@ eXdigit
Hexadecimal characters.
@ eCntrl
Control characters.
@ ePunct
Punctuation characters.
@ eAlpha
Alphabet characters.
@ eConstraintInvert
Logical NOT.
@ eConstraint
Constraint is not inverted (taken as is)
CException & operator=(const CException &)
Private assignment operator to prohibit assignment.
TFlags m_Flags
Flags, hints, attributes.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::iostream CNcbiIostream
Portable alias for iostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
NCBI_NS_STD::string::size_type SIZE_TYPE
ECase
Which type of string comparison.
@ eCase
Case sensitive compare.
#define NCBI_XNCBI_EXPORT
const GenericPointer< typename T::ValueType > T2 value
Miscellaneous common-use basic types and functionality.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Defines: CTimeFormat - storage class for time format.
@ fNoCreate
Command does not create blob if it does not exist.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4