(
const string& name,
const string& what,
const string& attr)
98 "\". "+ what + (attr.empty() ? attr :
": `"+ attr +
"'");
110 out<<
"<"<<
tag<<
">";
112 out<<
"</"<<
tag<<
">"<< endl;
152: m_Name(name), m_Ordinal(0), m_Flags(0), m_Standard(
false)
156 "Invalid argument name: "+
m_Name);
170 "Value lists not implemented for this argument: "+
m_Name);
207 #define THROW_CArg_NoValue \ 208 NCBI_THROW(CArgException,eNoValue, s_ArgExptMsg(GetName(), \ 209 "The argument has no value", ""));
245 #define THROW_CArg_ExcludedValue \ 246 NCBI_THROW(CArgException,eExcludedValue, s_ArgExptMsg(GetName(), \ 247 "The value is excluded by other arguments.", ""));
302 "Attempt to cast to a wrong (Int8) type",
AsString()));}
306 "Attempt to cast to a wrong (Integer) type",
AsString()));}
311 "Attempt to cast to a wrong (TIntId) type",
AsString()));
316 "Attempt to cast to a wrong (Double) type",
AsString()));}
320 "Attempt to cast to a wrong (Boolean) type",
AsString()));}
324 "Attempt to cast to a wrong (CDir) type",
AsString()));}
328 "Attempt to cast to a wrong (CTime) type",
AsString()));}
332 "Attempt to cast to a wrong (InputFile) type",
AsString()));}
336 "Attempt to cast to a wrong (OutputFile) type",
AsString()));}
340 "Attempt to cast to a wrong (IOFile) type",
AsString()));}
344 "Attempt to close an argument of non-file type",
AsString()));}
358 "Argument cannot be converted",
value));
375 "Attempt to cast to a wrong (TIntId) type",
AsString()));
386 if(m_Integer < kMin_Int || m_Integer >
kMax_Int) {
388 "Integer value is out of range",
value));
412 if(m_Integer < kMin_Int || m_Integer >
kMax_Int) {
414 "IntId value is out of range",
value));
426 "Attempt to cast to a wrong (Integer) type",
AsString()));
447 "Argument cannot be converted",
value));
496 "Argument cannot be converted",
value));
547 const char* fmt[] = {
555 for(
int i= 0; !res && fmt[
i]; ++
i) {
567 "Argument cannot be converted",
value));
582IOS_BASE::openmode openmode = (IOS_BASE::openmode) 0;
584openmode |= IOS_BASE::binary;
587openmode |= IOS_BASE::app;
596 const string& name,
const string&
value,
599m_DescriptionFlags(0),
619 "File is not accessible",
AsString()));
634 #define CHECK_STANDARD_ARG(func) \ 635 if (IsStandard()) { \ 636 ERR_POST_X(24, Error << func << \ 637 ": not allowed to use with a standard argument: "<< \
639_ASSERT(!IsStandard()); \
684 "CArg_Ios::CloseFile: file was not opened",
AsString()));
731 #if defined(NCBI_OS_MSWIN) 741 if( !fstrm->is_open() ) {
758 const string& name,
const string&
value,
791 #if defined(NCBI_OS_MSWIN) 803 if( !fstrm->is_open() ) {
821 const string& name,
const string&
value,
861 if( !fstrm->is_open() ) {
941 "Invalid argument name: "+
m_Name);
965 "No-value arguments may not be constrained",
1010role =
GetName().empty() ?
"extra":
"positional";
1018 out<<
"<"<< role <<
" name=\"";
1030 out<<
" optional=\"true\"";
1047 if(!constraint.empty()) {
1048 out<<
"<"<<
"constraint";
1050 out<<
" inverted=\"true\"";
1055 out<<
"</"<<
"constraint"<<
">"<< endl;
1061 out<<
"<"<<
"flags"<<
">";
1063 out<<
"<"<<
"preOpen"<<
"/>";
1066 out<<
"<"<<
"binary"<<
"/>";
1069 out<<
"<"<<
"append"<<
"/>";
1072 out<<
"<"<<
"truncate"<<
"/>";
1075 out<<
"<"<<
"noCreate"<<
"/>";
1078 out<<
"<"<<
"allowMultiple"<<
"/>";
1081 out<<
"<"<<
"ignoreInvalidValue"<<
"/>";
1084 out<<
"<"<<
"warnOnInvalidValue"<<
"/>";
1087 out<<
"<"<<
"optionalSeparator"<<
"/>";
1090 out<<
"<"<<
"mandatorySeparator"<<
"/>";
1093 out<<
"<"<<
"createPath"<<
"/>";
1096 out<<
"<"<<
"optionalSeparatorAllowConflict"<<
"/>";
1099 out<<
"<"<<
"hidden"<<
"/>";
1102 out<<
"<"<<
"confidential"<<
"/>";
1105 out<<
"<"<<
"standard"<<
"/>";
1107 out<<
"</"<<
"flags"<<
">"<< endl;
1126 const string& comment,
1147 "Invalid argument type",
"k_EType_Size"));
1161 "Argument type/flags mismatch",
1162 string(
"(type=") +
1181 str+=
", format: \"Y-M-DTh:m:gZ\" or \"Y/M/D h:m:gZ\"";
1185 if( !constr.empty() ) {
1268 "Disallowed value",
value));
1272err_msg =
"Illegal value, unexpected ";
1274err_msg =
"Illegal value, expected ";
1324 const string& comment,
1353 const string& comment,
1356 const string& default_value,
1357 const string& env_var,
1358 const char* display_value)
1361m_DefaultValue(default_value), m_EnvVar(env_var),
1362m_use_display(display_value !=
nullptr)
1379 const string&
value=
1381 if(!
value.empty()) {
1422: m_Synopsis(synopsis)
1424 for(string::const_iterator it =
m_Synopsis.begin();
1426 if(*it !=
'_'&& !
isalnum((
unsigned char)(*it))) {
1428 "Argument synopsis must be alphanumeric: "+
m_Synopsis);
1454 const string& comment,
1460m_SetValue(set_value)
1510 const string& comment,
1536 const string& comment,
1563 const string& comment,
1586 const string& comment,
1589 const string& default_value,
1590 const string& env_var,
1591 const char* display_value)
1613 const string& comment,
1616 const string& synopsis)
1640 return '-'+ name + separator + synopsis;
1657 const string& comment,
1660 const string& synopsis)
1688 const string& comment,
1691 const string& synopsis,
1692 const string& default_value,
1693 const string& env_var,
1694 const char* display_value)
1720 const string& arg_name,
1721 const string& comment)
1723m_ArgName(arg_name),
1724m_NegativeFlag(
false)
1792 if(
this!= &other) {
1808 return isalnum(c) || c ==
'_'|| c ==
'-';
1815 if(arg !=
m_Args.
end() || name.empty() || name[0] ==
'-'||
1825 if(arg !=
m_Args.
end() || name.empty() || name[0] ==
'-'||
1844 if(!name.empty() && name[0] ==
'#') {
1853 "Asked for an argument with invalid name: \""+
1858 "No \"extra\" (unnamed positional) arguments " 1861 if(idx == 0 || idx >=
m_nExtra) {
1863 "\"Extra\" (unnamed positional) arg is " 1871 "Unknown argument requested: \""+ name +
"\"");
1886vector< CRef<CArgValue> > res;
1888 if((**a).HasValue()) {
1889res.push_back( *
a);
1900 const string& arg_name = (*arg)->GetName();
1904 const CArgValue& arg_value = (*this)[arg_name];
1916 str+=
": <not assigned>\n";
1940 boolis_extra =
false;
1941 if( arg->
GetName().empty() ) {
1954 const string& v = arg->
AsString();
1959 "Argument with this name is defined already: " 1988istreambuf_iterator<char> it(
f.AsInputFile() );
1989vector<char>
value;
1990 std::copy( it, istreambuf_iterator<char>(), back_inserter(
value));
2005prompt =
"Please enter value of parameter '";
2009 if(!prompt.empty()) {
2016 #if defined(NCBI_OS_MSWIN) 2018 HANDLEhIn = GetStdHandle(STD_INPUT_HANDLE);
2023GetConsoleMode(hIn, &
mode);
2024silent_mode =
mode& ~ENABLE_ECHO_INPUT;
2025SetConsoleMode(hIn, silent_mode);
2029 while( ReadFile(hIn,
buffer, 256, &dw,
NULL) && dw != 0) {
2031 while(
buffer[dw-1] ==
'\n'||
buffer[dw-1] ==
'\r') {
2041SetConsoleMode(hIn,
mode);
2045 structtermios
mode, silent_mode;
2048silent_mode =
mode;
2049silent_mode.c_lflag &= ~
ECHO;
2054 intich = getchar();
2058 charch = (char) ich;
2059 if(ch ==
'\n'|| ch ==
'\r')
2063 if(
value.size() > 0) {
2075 if(!prompt.empty()) {
2089prompt =
"Please enter value of parameter '";
2095 #if defined(NCBI_OS_MSWIN) 2098 if(!prompt.empty()) {
2099hOut = CreateFile(
_TX(
"CONOUT$"),
2100GENERIC_WRITE, FILE_SHARE_WRITE,
NULL, OPEN_EXISTING,
2101FILE_ATTRIBUTE_NORMAL,
NULL);
2103WriteFile(hOut, prompt.data(), (
DWORD)prompt.length(), &dw,
NULL);
2107 HANDLEhIn = CreateFile(
_TX(
"CONIN$"),
2108GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ,
NULL, OPEN_EXISTING,
2109FILE_ATTRIBUTE_NORMAL,
NULL);
2113GetConsoleMode(hIn, &
mode);
2114silent_mode =
mode& ~ENABLE_ECHO_INPUT;
2115SetConsoleMode(hIn, silent_mode);
2119 while( ReadFile(hIn,
buffer, 256, &dw,
NULL) && dw != 0) {
2121 while(
buffer[dw-1] ==
'\n'||
buffer[dw-1] ==
'\r') {
2132SetConsoleMode(hIn,
mode);
2138WriteFile(hOut, thx.data(), (
DWORD)thx.length(), &dw,
NULL);
2142 inttty = open(
"/dev/tty", O_RDWR);
2144 if(!prompt.empty()) {
2145 if(write( tty, prompt.data(), prompt.length())) {}
2148 structtermios
mode, silent_mode;
2150tcgetattr( tty, &
mode);
2151silent_mode =
mode;
2152silent_mode.c_lflag &= ~
ECHO;
2153tcsetattr( tty, TCSANOW, &silent_mode );
2158 while( (
i= read(tty,
buffer, 256)) > 0) {
2160 while(
i> 0 && (
buffer[
i-1] ==
'\n'||
buffer[
i-1] ==
'\r')) {
2171tcsetattr( tty, TCSANOW, &
mode);
2173 if(!prompt.empty()) {
2174 if(write( tty, thx.data(), thx.length())) {}
2187 const string&
value)
const 2196 " for argument "<< arg_desc.
GetName() <<
2197 " - argument will be ignored.");
2211: m_ArgsType(eRegularArgs),
2215m_PositionalMode(ePositionalMode_Strict),
2216m_MiscFlags(fMisc_Default),
2217m_AutoHelp(auto_help),
2218m_HasHidden(
false),
2230 "Print USAGE and DESCRIPTION; ignore all other parameters");
2233 "Print USAGE, DESCRIPTION and ARGUMENTS;" 2234 " ignore all other parameters");
2236 "Print USAGE, DESCRIPTION and ARGUMENTS, including hidden ones;" 2237 " ignore all other parameters");
2239 "Print USAGE, DESCRIPTION and ARGUMENTS in XML format;" 2240 " ignore all other parameters");
2254 "File to which the program log should be redirected",
2258 if(default_config.empty()) {
2261 "Program's configuration (registry) data file",
2266 "Program's configuration (registry) data file",
2307 "File to which the program log should be redirected",
2319 "Program's configuration (registry) data file",
2331 "Print version number; ignore other arguments",
2349 "Print extended version data; ignore other arguments",
2355 "Print extended version data in XML format; ignore other arguments",
2361 "Print extended version data in JSON format; ignore other arguments",
2373 "Dry run the application: do nothing, only test all preconditions",
2396 "CGI application cannot have positional arguments, " 2397 "name of the offending argument: '" 2404 "CGI application cannot have unnamed positional " 2431 "Invalid argument type: k_EType_Size");
2433 returns_TypeName[(
int)
type];
2438(
const string& name,
2439 const string& synopsis,
2440 const string& comment,
2453(
const string& name,
2454 const string& synopsis,
2455 const string& comment,
2468(
const string& name,
2469 const string& synopsis,
2470 const string& comment,
2472 const string& default_value,
2474 const string& env_var,
2475 const char* display_value)
2478comment,
type,
flags, synopsis, default_value, env_var, display_value));
2486 const string& name,
2487 const string& comment,
2498 const string& name,
2499 const string& comment,
2511 const string& name,
2512 const string& comment,
2524 const string& name,
2525 const string& comment,
2529unique_ptr<CArgDesc_PosOpt> arg
2538 const string& name,
2539 const string& comment,
2541 const string& default_value,
2543 const string& env_var,
2544 const char* display_value)
2547comment,
type,
flags, default_value, env_var, display_value));
2555 unsignedn_mandatory,
2556 unsignedn_optional,
2557 const string& comment,
2561 if(!n_mandatory && !n_optional) {
2563 "Number of extra arguments cannot be zero");
2565 if(n_mandatory > 4096) {
2567 "Number of mandatory extra arguments is too big");
2573unique_ptr<CArgDesc_Pos> arg
2584 const string& arg_name)
2586unique_ptr<CArgDesc_Alias>arg
2594 const string& arg_name,
2595 const string& comment)
2601 "Attempt to negate a non-flag argument: "+ arg_name);
2604unique_ptr<CArgDesc_Alias> arg(
new CArgDesc_Alias(alias, arg_name, comment));
2605arg->SetNegativeFlag(
true);
2624 "Attempt to set constraint for undescribed argument: "+ name);
2626(*it)->SetConstraint(constraint, negate);
2637 "Clone method not implemented for: "+ name);
2645 const string& arg2)
2673 "Attempt to set error handler for undescribed argument: "+ name);
2691 "Argument description is not found");
2699 if( name.empty() ) {
2707TKeyFlagArgs::iterator it =
2720TPosArgs::iterator it =
2782 if( group.empty() ) {
2798 for(TPosArgs::const_iterator name =
m_PosArgs.begin();
2806 "Having both optional named and required unnamed " 2807 "positional arguments is prohibited");
2820 const string& name = arg.
GetName();
2825 const string&
n=
a.GetName();
2826 if(
n.length() == 1 &&
n[0] == name[0] &&
2830 string(
"'") + name[0] +
2831 "' argument allowed to contain no separator conflicts with '"+
2832name +
"' argument. To allow such conflicts, add"+
2833 " CArgDescriptions::fOptionalSeparatorAllowConflict flag into"+
2834 " description of '"+ name[0] +
"'.");
2844 stringname_aliased =
dynamic_cast<const CArgDesc_Alias&
>(arg).GetAliasedName();
2846it_aliased =
x_Find(name_aliased);
2851 CArgDesc& arg_aliased = **it_aliased;
2853 ERR_POST_X(25,
Error<<
"CArgDescriptions::AddAlias: alias '"<< name <<
2854 "' not allowed to use with a standard argument: "<< name_aliased);
2865 "Invalid default argument value");
2866}
catch(
constexception& e) {
2868 string(
"Invalid default value: ") + e.
what());
2883 if(arg.compare(
string(
"-") +
s_AutoHelp) == 0) {
2887}
else if(arg.compare(
string(
"-") +
s_AutoHelpFull) == 0) {
2889}
else if(arg.compare(
string(
"-") +
s_AutoHelpXml) == 0) {
2899 boolhave_arg2,
const string& arg2,
2900 unsigned* n_plain,
CArgs& args)
const 2904 boolis_keyflag =
false;
2915 size_targssofar = args.
GetAll().size();
2917 if((arg1.length() > 1) && arg1[0] ==
'-') {
2918name = arg1.substr(1);
2930 size_t eq= name.find(
'=');
2932name = name.substr(0,
eq);
2954 boolarg2_used =
false;
2957 if(*n_plain !=
kMax_UInt&& !is_keyflag) {
2969 "Too many positional arguments ("+
2971 "), the offending value: "+ arg1);
2975arg2_used =
x_CreateArg(arg1, name, have_arg2, arg2, *n_plain, args);
2983 const string& name_in,
2985 const string& arg2,
2994 stringname(name_in);
2995 boolarg2_used =
false;
2996 boolno_separator =
false;
2997 booleq_separator =
false;
3015 boolconfidential = it !=
m_Args.
end() &&
3017 charconf_method = confidential ?
't':
'\0';
3018 size_tdash = name.rfind(
'-');
3020 string test(name.substr(0, dash));
3021 stringsuffix(name.substr(dash+1));
3034name.size() > (dash+1)) {
3035confidential =
true;
3036conf_method = name[dash+1];
3047no_separator =
true;
3050 if( name.empty() ) {
3052 "Unexpected extra argument, at position # "+
3056 "Unknown argument: \""+ name +
"\"");
3065eq_separator = arg1.length() > name.length() &&
3066(arg1[name.length() + 1] ==
'=');
3067 if( eq_separator ) {
3074 if(
s_IsKey(arg) && !confidential) {
3075eq_separator = arg1.length() > name.length() &&
3076(arg1[name.length() + 1] ==
'=');
3077 if( !eq_separator ) {
3080 "Invalid argument: "+ arg1);
3083name.length() == 1 && arg1.length() > 2;
3089 if( !eq_separator && !no_separator ) {
3090 if( !
s_IsKey(arg) || (confidential && conf_method ==
't')) {
3102args.
Add(arg_value, update);
3115 if( no_separator ) {
3116arg_val = arg1.substr(2);
3119arg_val = arg1.substr(name.length() + 2);
3125 switch(conf_method) {
3170 boolallow_multiple =
false;
3180args.
Add(arg_value, update, allow_multiple);
3204 unsigned intn_plain,
3216 stringnameReq, nameExc;
3217 unsigned intnExtraReq = 0;
3218 unsigned intnExtraExc = 0;
3219 unsigned intnEx = 0;
3224 if(!args.
Exist(dep->first) || !args[dep->first]) {
3227 switch( dep->second.m_Dep ) {
3229require.
insert(make_pair(dep->second.m_Arg,dep->first));
3230 if(dep->second.m_Arg.at(0) ==
'#') {
3232 CTempString(dep->second.m_Arg.data()+1, dep->second.m_Arg.size()-1));
3233 if(nEx > nExtraReq) {
3235nameReq = dep->first;
3241 if(args.
Exist(dep->second.m_Arg) && args[dep->second.m_Arg]) {
3244 "Incompatible with argument", dep->first));
3246exclude.
insert(dep->second.m_Arg);
3247 if(dep->second.m_Arg.at(0) ==
'#') {
3249 CTempString(dep->second.m_Arg.data()+1, dep->second.m_Arg.size()-1));
3250 if(nEx > nExtraExc) {
3252nameExc = dep->first;
3258 if(nExtraReq != 0 && nExtraExc != 0 && nExtraReq >= nExtraExc) {
3260 "Conflicting dependencies on unnamed positional arguments: "+
3264nExtra =
max(nExtra, nExtraReq);
3265 if(nExtraExc > 0) {
3266nExtra =
max(nExtra, nExtraExc-1);
3271 if(!args.
Exist(*it)) {
3282 ") unnamed positional arguments. Must define at least "+
3287list<const CArgDesc*> def_args;
3290def_args.push_back(&arg);
3294def_args.push_back(&arg);
3299 i->GetPointer()->Evaluate(args);
3304 ITERATE(list<const CArgDesc*>, it, def_args) {
3313 stringrequester(require.
find(arg.
GetName())->second);
3317 "Must be specified, as it is required by argument", requester));
3324args.
Add(arg_exvalue);
3331args.
Add(arg_value);
3345(
const string& usage_name,
3346 const string& usage_description,
3347 boolusage_sort_args,
3350 if(usage_name.empty()) {
3358 #if defined(NCBI_OS_MSWIN) 3365 if(usage_width < kMinUsageWidth) {
3366usage_width = kMinUsageWidth;
3368 "CArgDescriptions::SetUsageContext() -- usage_width="<<
3369usage_width <<
" adjusted to "<< kMinUsageWidth);
3384string::const_iterator it = name.begin();
3385 if(extended && *it ==
'#') {
3386 for(++it; it != name.end(); ++it) {
3387 if( !
isdigit((
unsigned char)(*it)) ) {
3392 if(name[0] ==
'-') {
3395 if(name.length() == 1 || name[1] ==
'-') {
3399 for( ; it != name.end(); ++it) {
3411 const string& name = arg.
GetName();
3413 if(
Exist(name) ) {
3415 "Argument with this name is already defined: "+ name);
3424}
else if( !
s_IsAlias(arg) && !name.empty() ) {
3426 _ASSERT(find(container.begin(), container.end(), name)
3427== container.end());
3429container.push_back(name);
3431TPosArgs::iterator it;
3432 for(it = container.begin(); it != container.end(); ++it) {
3436container.insert(it, name);
3441name.length() == 1 &&
3477 if( !attr.empty() ) {
3482 t+=
'<'+ attr +
'>';
3484 arr.push_back( intro +
" - read value interactively from console");
3485 arr.push_back( intro +
"-file <"+
3489 t+=
'<'+ attr +
'>';
3507intro +=
", -"+ alias->
GetName();
3518 indent= intro.find(
" <");
3540pair<TDependency_CI, TDependency_CI> dep_rg =
3542 for(
TDependency_CIdep = dep_rg.first; dep != dep_rg.second; ++dep) {
3543 switch( dep->second.m_Dep ) {
3545 if( !require.empty() ) {
3548require += dep->second.m_Arg;
3551 if( !exclude.empty() ) {
3554exclude += dep->second.m_Arg;
3558 if( !require.empty() ) {
3561 if( !exclude.empty() ) {
3564 for(
const auto& c2n : comments_to_negatives) {
3565 const auto& negatives = c2n.second;
3567 ITERATE(list<string>, neg, negatives) {
3568 if( !neg_info.empty() ) {
3577neg_info =
" -"+ neg_info;
3582 stringneg_comment = c2n.first;
3583 if( neg_comment.empty() ) {
3584neg_comment =
"Negative for "+ arg.
GetName();
3599 typedeflist<const CArgDesc*> TList;
3600 typedefTList::iterator TListI;
3604TListI it_pos =
m_args.begin();
3607 for(TPosArgs::const_iterator name = desc.
m_OpeningArgs.begin();
3615 m_args.insert(it_pos, it->get());
3622TListI& it_opt_keys = it_pos;
3623TListI it_keys =
m_args.insert(it_pos,
nullptr);
3624TListI it_flags =
m_args.insert(it_pos,
nullptr);
3635 m_args.insert(it_opt_keys, arg);
3636}
else if(
dynamic_cast<const CArgDesc_Key*
>(arg)) {
3637 m_args.insert(it_keys, arg);
3645 m_args.insert(it_flags, arg);
3652 for(TKeyFlagArgs::const_iterator name = desc.
m_KeyFlagArgs.begin();
3661 m_args.insert(it_pos, it->get());
3666 for(TPosArgs::const_iterator name = desc.
m_PosArgs.begin();
3667name != desc.
m_PosArgs.end(); ++name) {
3679}
else if(
dynamic_cast<const CArgDesc_Pos*
>(arg)) {
3680 m_args.insert(it_pos, arg);
3691 m_args.push_back(it->get());
3702 const string& intro,
const string& prefix)
const 3704list<const CArgDesc*>::const_iterator it;
3706 if(m_desc.GetArgsType() ==
eCgiArgs) {
3707 for(it = m_args.begin(); it != m_args.end(); ++it) {
3712 const string& name = (*it)->GetName();
3714syn.push_back(name+
"="+synopsis);
3718syn, m_desc.m_UsageWidth,
"&",
arr, 0,
"?",
" "+m_desc.m_UsageName+
"?");
3721 if(!intro.empty()) {
3722syn.push_back(intro);
3724 for(it = m_args.begin(); it != m_args.end(); ++it) {
3726syn.push_back(
'['+ (*it)->GetUsageSynopsis() +
']');
3728syn.push_back(
'<'+ (*it)->GetUsageSynopsis() +
'>');
3730syn.push_back((*it)->GetUsageSynopsis());
3739 if( m_desc.m_UsageDescription.empty() ) {
3740 arr.push_back(
"DESCRIPTION -- none");
3742 arr.push_back(
"DESCRIPTION");
3744(detailed && !m_desc.m_DetailedDescription.empty()) ?
3745m_desc.m_DetailedDescription : m_desc.m_UsageDescription,
3746m_desc.m_UsageWidth);
3752 size_tmax_cmd_len,
booldetailed)
const 3757 stringcmd_full(
cmd);
3760 if(
a!= aliases->
end()) {
3761cmd_full +=
" ("+
a->second +
")";
3764cmd_full +=
string( max_cmd_len - cmd_full.size(),
' ');
3766cmd_full += m_desc.m_UsageDescription;
3767 arr.push_back(
string(
" ")+ cmd_full);
3769AddSynopsis(
arr,
string(max_cmd_len+3,
' '),
string(max_cmd_len+6,
' '));
3775list<const CArgDesc*>::const_iterator it;
3779 for(it = m_args.begin(); it != m_args.end(); ++it) {
3783m_desc.x_PrintComment(req, **it, m_desc.m_UsageWidth);
3786 for(
size_tgrp = 0; grp < m_desc.m_ArgGroups.size(); ++grp) {
3787list<string> grp_opt;
3788 boolgroup_not_empty =
false;
3789 if( !m_desc.m_ArgGroups[grp].empty() ) {
3790 NStr::Wrap(m_desc.m_ArgGroups[grp], m_desc.m_UsageWidth, grp_opt,
3793 for(it = m_args.begin(); it != m_args.end(); ++it) {
3797 if((*it)->GetGroup() == grp) {
3798m_desc.x_PrintComment(grp_opt, **it, m_desc.m_UsageWidth);
3799group_not_empty =
true;
3802 if( group_not_empty ) {
3803opt.insert(opt.end(), grp_opt.begin(), grp_opt.end());
3807 if( !req.empty() ) {
3809 arr.push_back(
"REQUIRED ARGUMENTS");
3810 arr.splice(
arr.end(), req);
3812 if( !m_desc.m_nExtra && !opt.empty() ) {
3814 arr.push_back(
"OPTIONAL ARGUMENTS");
3815 arr.splice(
arr.end(), opt);
3819 if(m_desc.m_nExtra || (m_desc.m_nExtraOpt && m_desc.m_nExtraOpt !=
kMax_UInt)) {
3820 stringstr_extra =
"NOTE: Specify ";
3821 if( m_desc.m_nExtra ) {
3822 if(m_desc.m_nExtraOpt)
3823str_extra +=
"at least ";
3825 if(m_desc.m_nExtraOpt && m_desc.m_nExtraOpt !=
kMax_UInt) {
3826str_extra +=
", and ";
3829 if(m_desc.m_nExtraOpt && m_desc.m_nExtraOpt !=
kMax_UInt) {
3830str_extra +=
"no more than ";
3834 " argument"+
string(&
"s"[m_desc.m_nExtra
3836? m_desc.m_nExtraOpt : 0) == 1]) +
3840 if( m_desc.m_nExtra && !opt.empty() ) {
3842 arr.push_back(
"OPTIONAL ARGUMENTS");
3843 arr.splice(
arr.end(), opt);
3846 if(!m_desc.m_DependencyGroups.empty()) {
3848 arr.push_back(
"DEPENDENCY GROUPS");
3850 i!= m_desc.m_DependencyGroups.end(); ++
i) {
3851 i->GetPointer()->PrintUsage(
arr, 0);
3862 arr.push_back(
"USAGE");
3874 arr.push_back(
"Use '-help' to print detailed descriptions of command line arguments");
3883: m_desc(desc), m_out(
out)
3885 m_out<<
"<?xml version=\"1.0\"?>"<< endl;
3886 m_out<<
"<"<<
"ncbi_application xmlns=\"ncbi:application\""<< endl
3887<<
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\""<< endl
3888<<
" xs:schemaLocation=\"ncbi:application ncbi_application.xsd\""<< endl
3890 m_out<<
"<"<<
"program"<<
" type=\"";
3892 m_out<<
"regular";
3896 m_out<<
"UNKNOWN";
3898 m_out<<
"\""<<
">"<< endl;
3904 m_out<<
"</"<<
"program"<<
">"<< endl;
3908m_out <<
"</"<<
"ncbi_application"<<
">"<< endl;
3913m_out <<
"<"<<
"arguments";
3915m_out <<
" positional_mode=\"loose\"";
3917m_out <<
">"<< endl;
3924 if((**a).GetName() == *p) {
3925 tag= (*a)->PrintXml(m_out);
3926m_out <<
"</"<<
tag<<
">"<< endl;
3933 if((**a).GetName() == *p) {
3934 tag= (*a)->PrintXml(m_out);
3936m_out <<
"</"<<
tag<<
">"<< endl;
3943 tag= (*a)->PrintXml(m_out);
3945m_out <<
"</"<<
tag<<
">"<< endl;
3951 tag= (*a)->PrintXml(m_out);
3954m_out <<
"</"<<
tag<<
">"<< endl;
3960 tag= (*a)->PrintXml(m_out);
3963m_out <<
"</"<<
tag<<
">"<< endl;
3967m_out <<
"<"<<
"dependencies"<<
">"<< endl;
3970m_out <<
"<"<<
"first_requires_second"<<
">"<< endl;
3973m_out <<
"</"<<
"first_requires_second"<<
">"<< endl;
3978m_out <<
"<"<<
"first_excludes_second"<<
">"<< endl;
3981m_out <<
"</"<<
"first_excludes_second"<<
">"<< endl;
3984m_out <<
"</"<<
"dependencies"<<
">"<< endl;
3988 i!= m_desc.m_DependencyGroups.end(); ++
i) {
3989 i->GetPointer()->PrintUsageXml(m_out);
3991m_out <<
"</"<<
"arguments"<<
">"<< endl;
4001 const string& name,
boolnegated
)
const 4008 string tag= negated ?
"negated_alias":
"alias";
4064 "Command cannot be empty: "+
cmd);
4093 if(!alias.empty()) {
4119vector<string> candidates;
4123candidates.push_back(d->first);
4126 if(candidates.size() == 1) {
4127 returncandidates.front();
4135 if(argv.
Size() > 1) {
4137 if(argv[1].
empty()) {
4149 returnd->second->CreateArgs(argv2)->SetCommand(
command);
4182 size_tcmdsize = cmdargs.
Size();
4185 if(
cmd.empty()) {
4198argdesc = d->second.get();
4217 arr.push_back(
"USAGE");
4229 arr.push_back(
"Use '-help "+
cmd+
"' to print detailed descriptions of command line arguments");
4240 arr.push_back(
"USAGE");
4241 arr.push_back(
string(
" ")+
m_UsageName+
" <command> [options]");
4242 arr.push_back(
"or");
4249 size_tmax_cmd_len = 0;
4251 size_talias_size=0;
4254alias_size =
a->second.size() + 3;
4256max_cmd_len =
max(max_cmd_len, d->first.size() + alias_size);
4264cmds.push_back(
t.first);
4276 ITERATE( list<string>, gi, cmdgroups) {
4278 booltitleprinted =
false;
4280grouptitle =
"Commands";
4285 ITERATE( list<string>, di, cmds) {
4287 if(j !=
m_Groups.
end() && j->second == group) {
4288 if(!titleprinted) {
4290 arr.push_back(grouptitle +
":");
4291titleprinted =
true;
4301 arr.push_back(
"AVAILABLE COMMANDS:");
4302 ITERATE( list<string>, di, cmds) {
4310 arr.push_back(
"Missing command:");
4316 arr.push_back(
"Use '-h command' to print help on a specific command");
4318 arr.push_back(
"Use '-help command' to print detailed descriptions of command line arguments");
4334 out<<
"<command>"<< endl;
4335 out<<
"<name>"<< d->first <<
"</name>"<< endl;
4337 out<<
"<alias>"<< (
m_Aliases.
find(d->first)->second) <<
"</alias>"<< endl;
4340 s_WriteXmlLine(
out,
"detailed_description", d->second->m_DetailedDescription);
4342 out<<
"</command>"<< endl;
4345 out<<
"<command_groups>"<< endl;
4347 out<<
"<name>"<<
g<<
"</name>"<< endl;
4351 out<<
"<command>"<< c <<
"</command>"<< endl;
4355 out<<
"</command_groups>"<< endl;
4362 all.push_back( d->second.get());
4403 const string& symbol_set)
4405 switch( symbol_class ) {
4418 returnsymbol_set.find_first_of(ch) !=
NPOS;
4425 const string& symbol_set)
4427 switch( symbol_class ) {
4447 switch( symbol_class ) {
4473 Allow( symbol_class);
4481 Allow( symbol_set);
4488 if(
value.length() != 1)
4504 if(!
usage.empty()) {
4510 return "one symbol: "+
usage;
4515 out<<
"<"<<
"Symbols"<<
">"<< endl;
4526 out<<
"</"<<
"Symbols"<<
">"<< endl;
4572string::const_iterator it;
4573 for(it =
value.begin(); it !=
value.end(); ++it) {
4577 if(it ==
value.end()) {
4589 if(!
usage.empty()) {
4595 return "to contain only symbols: "+
usage;
4601 out<<
"<"<<
"String"<<
">"<< endl;
4609 out<<
"</"<<
"String"<<
">"<< endl;
4657 return "ERROR: Constraint with no values allowed(?!)";
4669 if(
m_Strings.key_comp()(
"a",
"A") ) {
4670 str+=
" {case insensitive}";
4682 out<<
"<"<<
"Strings";
4683 out<<
" case_sensitive=\"";
4684 if(
m_Strings.key_comp()(
"a",
"A") ) {
4689 out<<
"\">"<< endl;
4693 out<<
"</"<<
"Strings"<<
">"<< endl;
4731 if(
pi->first <=
val&& val<= pi->second) {
4744 if(x_min == x_max) {
4756 if(!
usage.empty()) {
4759 if(
pi->first ==
pi->second) {
4772 string tag(
"Int8s");
4776 out<<
"<"<<
tag<<
">"<< endl;
4781 out<<
"</"<<
tag<<
">"<< endl;
4824 if(x_min == x_max) {
4866 if(
pi->first <=
val&& val<= pi->second) {
4879 if(x_min == x_max) {
4891 if(!
usage.empty()) {
4894 if(
pi->first ==
pi->second) {
4907 out<<
"<"<<
"Doubles"<<
">"<< endl;
4912 out<<
"</"<<
"Doubles"<<
">"<< endl;
4938 const string& name,
const string& description)
4942gr->m_Description = description;
4947: m_MinMembers(0), m_MaxMembers(0)
4987 booltop_level = !arg_set || !arg_unset;
4988 boolhas_instant_set =
false;
4989 size_tcount_set = 0;
4991 stringargs_set, args_unset;
4995 stringmsg_set, msg_unset;
4996 if(
i->first.GetPointer()->x_Evaluate(args, &msg_set, &msg_unset)) {
4998has_instant_set = has_instant_set || (
i->second ==
eInstantSet);
4999names_set.
insert(msg_set);
5001names_unset.
insert(msg_unset);
5006 if(args.
Exist(
i->first)) {
5008has_instant_set = has_instant_set || (
i->second ==
eInstantSet);
5009names_set.
insert(
i->first);
5011names_unset.
insert(
i->first);
5017 if(names_set.
size() > 1) {
5018args_set =
"("+
NStr::Join(names_set,
", ") +
")";
5019}
else if(names_set.
size() == 1) {
5020args_set = *names_set.
begin();
5023 if(names_unset.
size() > 1) {
5025}
else if(names_unset.
size() == 1) {
5026args_unset = *names_unset.
begin();
5029 bool result= count_set != 0 || top_level;
5031 if(count_set > count_max) {
5032 string msg(
"Argument conflict: ");
5033 msg+= args_set +
" may not be specified simultaneously";
5037 string msg(
"Argument has no value: ");
5038 if(count_total != count_max) {
5042 msg+= args_unset +
" must be specified";
5047*arg_set = args_set;
5050*arg_unset = args_unset;
5058 stringoff(2*
offset,
' ');
5063list<string> instant;
5070 msg+=
i->first.GetPointer()->m_Name;
5072instant.push_back(
i->first.GetPointer()->m_Name);
5083instant.push_back(
i->first);
5096 msg= off +
"in which ";
5101}
else if(count_max == count_total &&
m_MinMembers!= 0) {
5102 msg+=
"at least ";
5104}
else if(count_max != count_total &&
m_MinMembers== 0) {
5105 msg+=
"no more than ";
5118 msg+=
" must be set";
5121 if(!instant.empty()) {
5123 msg+=
"Instant set: ";
5129 i->first.GetPointer()->PrintUsage(
arr,
offset+1);
5135 out<<
"<"<<
"dependencygroup"<<
">"<< endl;
5136 out<<
"<"<<
"name"<<
">"<<
m_Name<<
"</"<<
"name"<<
">"<< endl;
5137 out<<
"<"<<
"description"<<
">"<<
m_Description<<
"</"<<
"description"<<
">"<< endl;
5141 out<<
"<"<<
"group";
5143 out<<
" instantset=\"true\"";
5145 out<<
">"<<
i->first.GetPointer()->m_Name <<
"</"<<
"group"<<
">"<< endl;
5149 out<<
"<"<<
"argument";
5151 out<<
" instantset=\"true\"";
5153 out<<
">"<<
i->first <<
"</"<<
"argument"<<
">"<< endl;
5155 out<<
"<"<<
"minmembers"<<
">"<<
m_MinMembers<<
"</"<<
"minmembers"<<
">"<< endl;
5156 out<<
"<"<<
"maxmembers"<<
">"<<
m_MaxMembers<<
"</"<<
"maxmembers"<<
">"<< endl;
5159 i->first.GetPointer()->PrintUsageXml(
out);
5161 out<<
"</"<<
"dependencygroup"<<
">"<< endl;
5171 case eNoValue:
return "eNoValue";
5174 case eConvert:
return "eConvert";
5175 case eNoFile:
return "eNoFile";
5177 case eArgType:
return "eArgType";
5178 case eNoArg:
return "eNoArg";
5187 case eHelp:
return "eHelp";
5190 case eHelpXml:
return "eHelpXml";
5191 case eHelpErr:
return "eHelpErr";
ncbi::TMaskedQueryRegions mask
virtual ~CArgDescDefault(void)
virtual void VerifyDefault(void) const
Verify argument default value.
const string & GetDisplayValue(void) const
const string & GetDefaultValue(void) const
CArgDescDefault(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags, const string &default_value, const string &env_var, const char *display_value)
virtual CArgValue * ProcessDefault(void) const
Process argument default.
virtual CArgValue * ProcessArgument(const string &value) const
Process argument with specified value.
CArgDescriptions::EConstraintNegate m_NegateConstraint
CArgDescriptions::EType GetType(void) const
virtual string GetUsageCommentAttr(void) const
Get usage comment attribute.
CConstRef< CArgAllow > m_Constraint
virtual bool IsConstraintInverted() const
Returns TRUE if associated constraint is inverted (NOT)
virtual const CArgAllow * GetConstraint(void) const
Get argument constraint.
virtual void SetConstraint(const CArgAllow *constraint, CArgDescriptions::EConstraintNegate negate)
Set argument constraint.
virtual CArgValue * ProcessDefault(void) const
Process argument default.
CArgDescMandatory(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags)
virtual ~CArgDescMandatory(void)
virtual ~CArgDescOptional(void)
virtual CArgValue * ProcessDefault(void) const
Process argument default.
CArgDescOptional(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags)
const string & GetSynopsis(void) const
CArgDescSynopsis(const string &synopsis)
virtual string GetUsageCommentAttr(void) const
Get usage comment attribute.
virtual string GetUsageSynopsis(bool name_only) const
Get usage synopsis.
const string & GetAliasedName(void) const
virtual CArgValue * ProcessArgument(const string &value) const
Process argument with specified value.
virtual ~CArgDesc_Alias(void)
CArgDesc_Alias(const string &alias, const string &arg_name, const string &comment)
bool GetNegativeFlag(void) const
virtual CArgValue * ProcessDefault(void) const
Process argument default.
virtual ~CArgDesc_Flag(void)
CArgDesc_Flag(const string &name, const string &comment, bool set_value, CArgDescriptions::TFlags flags)
virtual CArgValue * ProcessArgument(const string &value) const
Process argument with specified value.
virtual string GetUsageCommentAttr(void) const
Get usage comment attribute.
bool GetSetValue(void) const
virtual string GetUsageSynopsis(bool name_only=false) const
Get usage synopsis.
virtual CArgValue * ProcessDefault(void) const
Process argument default.
CArgDesc_KeyDef(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags, const string &synopsis, const string &default_value, const string &env_var, const char *display_value)
virtual string GetUsageSynopsis(bool name_only=false) const
Get usage synopsis.
virtual ~CArgDesc_KeyDef(void)
virtual string GetUsageSynopsis(bool name_only=false) const
Get usage synopsis.
virtual ~CArgDesc_KeyOpt(void)
CArgDesc_KeyOpt(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags, const string &synopsis)
CArgDesc_Key(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags, const string &synopsis)
virtual ~CArgDesc_Key(void)
virtual string GetUsageSynopsis(bool name_only=false) const
Get usage synopsis.
virtual CArgValue * ProcessArgument(const string &) const
Process argument with specified value.
virtual CArgValue * ProcessDefault(void) const
Process argument default.
virtual string GetUsageCommentAttr(void) const
Get usage comment attribute.
virtual string GetUsageSynopsis(bool) const
Get usage synopsis.
CArgDesc_NameOnly(const string &name)
virtual ~CArgDesc_Opening(void)
CArgDesc_Opening(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags)
virtual string GetUsageSynopsis(bool name_only=false) const
Get usage synopsis.
CArgDesc_PosDef(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags, const string &default_value, const string &env_var, const char *display_value)
virtual ~CArgDesc_PosDef(void)
virtual ~CArgDesc_PosOpt(void)
CArgDesc_PosOpt(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags)
virtual string GetUsageSynopsis(bool name_only=false) const
Get usage synopsis.
CArgDesc_Pos(const string &name, const string &comment, CArgDescriptions::EType type, CArgDescriptions::TFlags flags)
virtual ~CArgDesc_Pos(void)
virtual bool AsBoolean(void) const
Get the argument's boolean value.
CArg_Boolean(const string &name, bool value)
CArg_DataSize(const string &name, const string &value)
virtual Int8 AsInt8(void) const
Get the argument's integer (8-byte long) value.
virtual const CTime & AsDateTime() const
Get the argument as a DateTime.
CArg_DateTime(const string &name, const string &value)
CArg_Dir(const string &name, const string &value, CArgDescriptions::TFlags flags)
TFileFlags m_DescriptionFlags
virtual const CDir & AsDirectory() const
Get the argument as a directory.
virtual double AsDouble(void) const
Get the argument's double value.
CArg_Double(const string &name, const string &value)
virtual double AsDouble(void) const
Get the argument's double value.
virtual const CDir & AsDirectory(void) const
Get the argument as a directory.
virtual CNcbiIstream & AsInputFile(TFileFlags flags=0) const
Get the argument as an input file stream.
virtual CNcbiIostream & AsIOFile(TFileFlags flags=0) const
Get the argument as a file stream.
virtual bool AsBoolean(void) const
Get the argument's boolean value.
virtual Int8 AsInt8(void) const
Get the argument's integer (8-byte long) value.
virtual bool HasValue(void) const
Check if argument holds a value.
virtual TIntId AsIntId(void) const
Get the argument's value as an integer id (TIntId).
virtual const string & AsString(void) const
Get the argument's string value.
virtual void CloseFile(void) const
Close the file.
virtual int AsInteger(void) const
Get the argument's integer value.
virtual CNcbiOstream & AsOutputFile(TFileFlags flags=0) const
Get the argument as an output file stream.
CArg_ExcludedValue(const string &name)
virtual const CTime & AsDateTime(void) const
Get the argument as a DateTime.
CArg_Flag(const string &name, bool value)
virtual bool HasValue(void) const
Check if argument holds a value.
virtual void x_Open(TFileFlags flags) const
CArg_IOFile(const string &name, const string &value, CArgDescriptions::TFlags flags)
virtual void x_Open(TFileFlags flags) const
CArg_InputFile(const string &name, const string &value, CArgDescriptions::TFlags flags)
virtual Int8 AsInt8(void) const
Get the argument's integer (8-byte long) value.
CArg_Int8(const string &name, const string &value)
virtual TIntId AsIntId(void) const
An Int8 argument can be used as an integer id only if NCBI_INT8_GI is defined.
virtual TIntId AsIntId(void) const
An Int8 argument can be used as an integer id only if NCBI_INT8_GI is defined.
CArg_IntId(const string &name, const string &value)
virtual int AsInteger(void) const
An IntId argument can be used as an integer only if NCBI_INT8_GI is not defined.
virtual TIntId AsIntId(void) const
An integer argument can also be used as an integer id.
CArg_Integer(const string &name, const string &value)
virtual int AsInteger(void) const
Get the argument's integer value.
virtual CNcbiIostream & AsIOFile(TFileFlags flags=0) const
Get the argument as a file stream.
bool x_CreatePath(TFileFlags flags) const
virtual CNcbiOstream & AsOutputFile(TFileFlags flags=0) const
Get the argument as an output file stream.
CArg_Ios(const string &name, const string &value, CArgDescriptions::TFlags flags)
virtual CNcbiIstream & AsInputFile(TFileFlags flags=0) const
Get the argument as an input file stream.
TFileFlags m_DescriptionFlags
virtual void CloseFile(void) const
Close the file.
virtual void x_Open(TFileFlags flags) const
static IOS_BASE::openmode IosMode(TFileFlags flags)
TFileFlags m_CurrentFlags
virtual const string & AsString(void) const
Get the argument's string value.
virtual bool HasValue(void) const
Check if argument holds a value.
CArg_NoValue(const string &name)
virtual Int8 AsInt8(void) const
Get the argument's integer (8-byte long) value.
virtual bool AsBoolean(void) const
Get the argument's boolean value.
virtual const CTime & AsDateTime(void) const
Get the argument as a DateTime.
virtual double AsDouble(void) const
Get the argument's double value.
virtual CNcbiOstream & AsOutputFile(TFileFlags flags=0) const
Get the argument as an output file stream.
virtual CNcbiIstream & AsInputFile(TFileFlags flags=0) const
Get the argument as an input file stream.
virtual CNcbiIostream & AsIOFile(TFileFlags flags=0) const
Get the argument as a file stream.
virtual int AsInteger(void) const
Get the argument's integer value.
virtual const CDir & AsDirectory(void) const
Get the argument as a directory.
virtual TIntId AsIntId(void) const
Get the argument's value as an integer id (TIntId).
virtual void CloseFile(void) const
Close the file.
CArg_OutputFile(const string &name, const string &value, CArgDescriptions::TFlags flags)
virtual void x_Open(TFileFlags flags) const
virtual CNcbiIstream & AsInputFile(TFileFlags flags=0) const
Get the argument as an input file stream.
TStringArray m_StringList
Value of the argument as passed to the constructor ("value") becomes the first element in the value l...
virtual bool AsBoolean(void) const
Get the argument's boolean value.
virtual TIntId AsIntId(void) const
Get the argument's value as an integer id (TIntId).
virtual Int8 AsInt8(void) const
Get the argument's integer (8-byte long) value.
CArg_String(const string &name, const string &value)
virtual const TStringArray & GetStringList() const
Get the value list.
virtual const string & AsString(void) const
Get the argument's string value.
virtual CNcbiIostream & AsIOFile(TFileFlags flags=0) const
Get the argument as a file stream.
virtual int AsInteger(void) const
Get the argument's integer value.
virtual TStringArray & SetStringList()
Get reference on value list for further modification.
virtual bool HasValue(void) const
Check if argument holds a value.
virtual const CTime & AsDateTime(void) const
Get the argument as a DateTime.
virtual double AsDouble(void) const
Get the argument's double value.
virtual const CDir & AsDirectory(void) const
Get the argument as a directory.
virtual CNcbiOstream & AsOutputFile(TFileFlags flags=0) const
Get the argument as an output file stream.
virtual void CloseFile(void) const
Close the file.
Template used to replace bool type arguments with some strict equivalent.
static CNcbiApplication * Instance(void)
Singleton method.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Define Case-insensitive string comparison methods.
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
const_iterator lower_bound(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator_pair equal_range(const key_type &key) const
iterator insert(const value_type &val)
container_type::value_type value_type
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
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)
#define test(a, b, c, d, e)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
const CNcbiEnvironment & GetEnvironment(void) const
Get the application's cached environment.
static CNcbiApplicationAPI * Instance(void)
Singleton method.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const string & GetProgramDisplayName(void) const
Get the application's "display" name.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
virtual list< CArgDescriptions * > GetAllDescriptions(void)
CArgAllow_Strings & AllowValue(const string &value)
Add allowed string values.
unsigned int TCommandArgFlags
Bitwise OR of ECommandArgFlags.
void AddFlag(const string &name, const string &comment, CBoolEnum< EFlagValue > set_value=eFlagHasValueIfSet, TFlags flags=0)
Add description for flag argument.
TArgs::const_iterator TArgsCI
Type for const iterator.
CArgDependencyGroup & Add(const string &arg_name, EInstantSet instant_set=eNoInstantSet)
Make a regular argument a member of this dependency group.
TArgGroups m_ArgGroups
Argument groups.
string x_IdentifyCommand(const string &command) const
virtual CArgValue * ProcessDefault(void) const =0
Process argument default.
CArgAllow_Int8s & AllowRange(Int8 from, Int8 to)
Add allow values.
virtual string & PrintUsage(string &str, bool detailed=false) const
Print usage message to end of specified string.
void Reset(void)
Remove all arguments.
CArgs * CreateArgs(TSize argc, TArray argv) const
Create parsed arguments in CArgs object.
CArgDescriptions(bool auto_help=true, CArgErrorHandler *err_handler=0)
Constructor.
CArgDescriptions::TFlags GetFlags(void) const
Get argument flags.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
const CArgValue & operator[](const string &name) const
Get value of argument by name.
void x_CheckAutoHelp(const string &arg) const
Helper method for checking if auto help requested and throw CArgHelpException if help requested.
CArgAllow_Doubles & Allow(double value)
map< string, EInstantSet > m_Arguments
TArgsI x_Find(const string &name, bool *negative=NULL)
Helper method to find named parameter.
virtual string GetUsage(void) const
Get usage information.
virtual void PrintUsageXml(CNcbiOstream &out) const
Print constraints in XML format.
string m_Name
Argument name.
void AddExtra(unsigned n_mandatory, unsigned n_optional, const string &comment, EType type, TFlags flags=0)
Add description for the extra, unnamed positional arguments.
virtual const string & AsString(void) const =0
Get the argument's string value.
string & Print(string &str) const
Print (append) all arguments to the string "str" and return "str".
list< const CArgDesc * > m_args
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
void x_PrintAliasesAsXml(CNcbiOstream &out, const string &name, bool negated=false) const
void AddDependencyGroup(CArgDependencyGroup *dep_group)
Add a dependency group.
string m_Command
current command
map< CConstRef< CArgDependencyGroup >, EInstantSet > m_Groups
virtual void SetConstraint(const CArgAllow *constraint, CArgDescriptions::EConstraintNegate negate=CArgDescriptions::eConstraint)
Set argument constraint.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
TArgs m_Args
Assoc.map of arguments' name/descr.
string m_Name
Argument name.
virtual bool Verify(const string &value) const
Verify if specified value is allowed.
CRef< CArgErrorHandler > m_ErrorHandler
Global error handler or NULL.
size_t x_GetGroupIndex(const string &group) const
Get group index.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
const string & GetName(void) const
Get argument name.
virtual ~CArgDescriptions(void)
Destructor.
virtual string GetUsageSynopsis(bool name_only=false) const =0
Get usage synopsis.
CArgDependencyGroup & SetMaxMembers(size_t max_members)
TPosArgs m_OpeningArgs
Opening args, ordered by position in cmd.-line.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
void AddNegatedFlagAlias(const string &alias, const string &arg_name, const string &comment=kEmptyStr)
Add negated alias for a flag argument.
void SetConstraint(const string &name, const CArgAllow *constraint, EConstraintNegate negate=eConstraint)
Set additional user defined constraint on argument value.
void AddDetails(list< string > &arr) const
CArgValue(const string &name)
Protected constructor and destructor.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
TArgsCI x_Find(const string &name) const
Find argument value with name "name".
void SetDependency(const string &arg1, EDependency dep, const string &arg2)
Define a dependency.
CArgDescriptions * ShowAllArguments(bool show_all)
Include hidden arguments into USAGE.
void PrintArguments(const CArgDescriptions &desc) const
virtual void PrintUsageXml(CNcbiOstream &out) const
Print argument description in XML format.
bool Exist(const string &name) const
Check existence of argument description.
CArgAllow_Symbols & Allow(ESymbolClass symbol_class)
Add allowed symbols.
void SetMiscFlags(TMiscFlags flags)
Set the selected flags.
void AddDefaultPositional(const string &name, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional positional argument with default value.
SIZE_TYPE m_UsageWidth
Maximum length of a usage line.
void PrintUsage(list< string > &arr, size_t offset) const
void AddKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for mandatory key.
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.
virtual void AddStdArguments(THideStdArgs mask)
Add standard arguments.
string m_Comment
Argument description.
TDependencies::const_iterator TDependency_CI
void SetUsageContext(const string &usage_name, const string &usage_description, bool usage_sort_args=false, SIZE_TYPE usage_width=78)
Set extra info to be used by PrintUsage().
void AddAlias(const string &alias, const string &arg_name)
Add argument alias.
void PrintUsageIfNoArgs(bool do_print=true)
Print usage and exit.
virtual void SetErrorHandler(CArgErrorHandler *)
Set error handler for the argument.
virtual bool IsConstraintInverted() const
Returns TRUE if associated constraint is inverted (NOT)
unsigned int TFileFlags
Bitwise OR of "EFileFlags".
virtual void PrintUsageXml(CNcbiOstream &out) const
Print constraints in XML format.
virtual const CArgAllow * GetConstraint(void) const
Get argument constraint.
virtual const char * GetErrCodeString(void) const override
Translate from the error code value to its string representation.
CArgs & Assign(const CArgs &other)
Copy contents of another object into this one.
void x_PreCheck(void) const
Helper method for doing pre-processing consistency checks.
void Delete(const string &name)
Delete description of argument with name "name".
virtual string GetUsage(void) const
Get usage information.
EArgSetType GetArgsType() const
void AddPositional(const string &name, const string &comment, EType type, TFlags flags=0)
Add description for mandatory positional argument.
virtual string GetUsage(void) const =0
Get usage information.
static const char * GetTypeName(EType type)
Get argument type's name.
CArgs & operator=(const CArgs &other)
Creating copy of this object usually makes no sense if it is really required, please use Assign metho...
CArgDependencyGroup(void)
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 void PrintUsageXml(CNcbiOstream &out) const
Print constraints in XML format.
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.
EArgSetType m_ArgsType
Type of arguments.
const string & GetName(void) const
Get argument name.
virtual void PrintUsageXml(CNcbiOstream &out) const
Print constraints in XML format.
void AddOptionalKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for optional key without default value.
void AddCommand(const string &cmd, CArgDescriptions *description, const string &alias=kEmptyStr, ECommandFlags flags=eDefault)
Add command argument descriptions.
void AddOptionalPositional(const string &name, const string &comment, EType type, TFlags flags=0)
Add description for optional positional argument without default value.
virtual void PrintUsageXml(CNcbiOstream &out) const
Print constraints in XML format.
friend class CCommandArgDescriptions
void SetOrdinalPosition(size_t pos)
virtual string GetUsage(void) const
Get usage information.
void SetArgsType(EArgSetType args_type)
Set type of argument description (cmdline vs CGI).
CArgAllow_Strings(NStr::ECase use_case=NStr::eCase)
Constructor.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
set< TSymClass > m_SymClass
CArgDescriptions::TFlags m_Flags
void AddSynopsis(list< string > &arr, const string &intro, const string &prefix) const
void SetDetailedDescription(const string &usage_description)
Set detailed usage description.
size_t m_CurrentCmdGroup
current group #
virtual bool Verify(const string &value) const
Verify if specified value is allowed.
set< CConstRef< CArgDependencyGroup > > m_DependencyGroups
size_t x_GetCommandGroupIndex(const string &group) const
virtual string GetUsage(void) const
Get usage information.
virtual void SetGroup(size_t)
Set argument group.
virtual void PrintUsageXml(CNcbiOstream &out) const
Print constraints in XML format.
virtual void AddStdArguments(THideStdArgs mask)
Add standard arguments.
virtual bool Verify(const string &value) const =0
Verify if specified value is allowed.
list< string > m_Commands
command names, and order
bool x_Evaluate(const CArgs &args, string *arg_set, string *arg_unset) const
virtual bool Verify(const string &value) const
Verify if specified value is allowed.
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.
virtual CArgs * CreateArgs(const CNcbiArguments &argv) const
Parse command-line arguments 'argv'.
void x_SetDefault(const string &def_value, bool from_def)
void Add(CArgValue *arg, bool update=false, bool add_value=false)
Add new argument name and value.
virtual string & PrintUsage(string &str, bool detailed=false) const
Print usage message to end of specified string.
void Remove(const string &name)
Remove argument of name "name".
virtual ~CArgDependencyGroup(void)
TDependencies m_Dependencies
Arguments' dependencies.
map< string, string > m_Aliases
command to alias; one alias only
void AddOpening(const string &name, const string &comment, EType type, TFlags flags=0)
Add description of mandatory opening positional argument.
CArgAllow_Doubles & AllowRange(double from, double to)
Add allowed values.
unsigned int TFlags
Bitwise OR of "EFlags".
bool IsEmpty(void) const
Check if there are no arguments in this container.
vector< CRef< CArgValue > > GetAll(void) const
Get all available arguments.
virtual CArgAllow * Clone(void) const
Create object's clone, moving it from stack memory into heap.
TArgs m_Args
Assoc. map of arguments' name/value.
void AddDescription(list< string > &arr, bool detailed) const
size_t m_nExtra
Cached # of unnamed positional arguments.
set< TInterval > m_MinMax
void SetErrorHandler(const string &name, CArgErrorHandler *err_handler)
Set individual error handler for the argument.
list< string > TKeyFlagArgs
List of flag arguments.
CArgAllow_Strings * Allow(const string &value)
Add allowed string values.
virtual CArgValue * ProcessArgument(const string &value) const =0
Process argument with specified value.
EDependency
Dependencies between arguments.
virtual bool Verify(const string &value) const
Verify if specified value is allowed.
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 ...
virtual void VerifyDefault(void) const
Verify argument default value.
void SetCurrentGroup(const string &group)
Set current arguments group name.
virtual CArgValue * HandleError(const CArgDesc &arg_desc, const string &value) const
Process invalid argument value.
size_t m_CurrentGroup
Currently selected group (0 = no group)
string m_DetailedDescription
Program long description.
virtual string GetUsage(void) const
Get usage information.
EType
Available argument types.
void PrintUsageXml(CNcbiOstream &out) const
bool x_IsCommandMandatory(void) const
string m_UsageDescription
Program description.
TDescriptions m_Description
command to ArgDescriptions
const string & GetComment(void) const
Get argument description.
CPrintUsage(const CArgDescriptions &desc)
virtual string GetUsage(void) const
Get usage information.
virtual ~CCommandArgDescriptions(void)
Destructor.
CArgDependencyGroup & SetMinMembers(size_t min_members)
string m_NoSeparator
Arguments allowed to use no separator.
virtual TStringArray & SetStringList()
Get reference on value list for further modification.
virtual ~CArgDesc(void)
Destructor.
int THideStdArgs
Binary OR of "EHideStdArgs".
virtual bool Verify(const string &value) const
Verify if specified value is allowed.
unsigned int TArgValueFlags
Bitwise OR of "EArgValueFlags".
CPrintUsageXml(const CArgDescriptions &desc, CNcbiOstream &out)
bool Exist(const string &name) const
Check if there is already an argument description with specified name.
bool m_AutoHelp
Special flag "-h" activated.
TArgs::const_iterator TArgsCI
Const arguments iterator.
vector< string > TStringArray
Some values types can contain several value lists.
const string & GetDefault(TArgValueFlags *flags=NULL) const
Get default value of the argument.
static CRef< CArgDependencyGroup > Create(const string &name, const string &description=kEmptyStr)
Create new dependency group.
set< TInterval > m_MinMax
vector< string > TPosArgs
Positional arg. vector.
void Evaluate(const CArgs &args) const
ESymbolClass
Symbol class for defining sets of characters.
EArgPositionalMode m_PositionalMode
Processing of positional args.
CArgDesc(const string &name, const string &comment, CArgDescriptions::TFlags flags=0)
Constructor.
string GetUsageConstraint(void) const
Get usage constraint.
virtual void PrintUsageXml(CNcbiOstream &out) const
Print argument description in XML format.
void AddCommandDescription(list< string > &arr, const string &cmd, const map< string, string > *aliases, size_t max_cmd_len, bool detailed) const
unsigned m_nExtraOpt
> # of mandatory extra args
virtual const TStringArray & GetStringList() const
Get the value list.
TKeyFlagArgs m_KeyFlagArgs
Key/flag args, in order of insertion.
EConstraintNegate
Flag to invert constraint logically.
map< string, size_t > m_Groups
command to group #
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.
void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional key with default value.
void AddDefaultFileArguments(const string &default_config)
Add logfile and conffile arguments.
static bool VerifyName(const string &name, bool extended=false)
Verify if argument "name" is spelled correctly.
CArgAllow_Int8s & Allow(Int8 value)
virtual list< CArgDescriptions * > GetAllDescriptions(void)
TCommandArgFlags m_Cmd_req
string PrintXml(CNcbiOstream &out) const
Print description in XML format.
void SetCurrentCommandGroup(const string &group)
Set current command group name.
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.
@ fOptionalSeparator
Allow to ignore separator between the argument's name and value.
@ fMandatorySeparator
Require '=' separator.
@ fStandard
Mark standard/special flag. For internal use only.
@ fFileFlags
Mask for all file-related flags.
@ fAppend
Append to end-of-file; for eOutputFile or eIOFile.
@ fCreatePath
If needed, create directory where the file is located.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ fWarnOnInvalidValue
Post warning when an invalid value is ignored (no effect if fIgnoreInvalidValue is not set).
@ fBinary
Open as binary file; for eInputFile, eOutputFile, eIOFile.
@ fNoCreate
If the file does not exist, do not create it; for eOutputFile or eIOFile.
@ fTruncate
Delete contents of an existing file; for eOutputFile or eIOFile.
@ fOptionalSeparatorAllowConflict
For arguments with fOptionalSeparator flag, allow other arguments which names begin with the same cha...
@ fConfidential
Confidential argument Such arguments can be read from command line, from file, or from console.
@ fIgnoreInvalidValue
Ignore invalid argument values.
@ fPreOpen
Open file right away; for eInputFile, eOutputFile, eIOFile.
@ fHidden
Hide it in Usage.
@ eConvertKeys
called by ConvertKeys()
@ eHidden
Hide command in Usage.
@ eHelpShowAll
Error code for detailed help message which includes hidden arguments.
@ eHelpErr
Show short help message and return error.
@ eHelp
Error code for short help message.
@ eHelpXml
Error code for XML formatted help message.
@ eHelpFull
Error code for detailed help message.
@ fUsageIfNoArgs
Force printing USAGE (and then exit) if no command line args are present.
@ fUsageSortArgs
Sort args when printing USAGE.
@ eExcludedValue
The value is excluded by another argument.
@ eNoFile
Expecting a file.
@ eNoValue
Expecting an argument value.
@ eWrongCast
Incorrect cast for an argument.
@ eSynopsis
Synopsis error.
@ eArgType
Wrong argument type.
@ eConvert
Conversion problem.
@ eConstraint
Argument value outside constraints.
@ eInvalidArg
Invalid argument.
@ fArgValue_HasDefault
Has default value.
@ fArgValue_FromDefault
Not provided in command line.
@ eCgiArgs
CGI application.
@ eRegularArgs
Regular application.
@ eRequires
One argument requires another.
@ eExcludes
One argument excludes another.
@ eNoSortCommands
On PrintUsage, keep commands unsorted.
@ eNoSortGroups
On PrintUsage, keep command groups unsorted.
@ eCommandOptional
Command is not necessary.
@ eDateTime
DateTime string, formats: "M/D/Y h:m:s", "Y-M-DTh:m:g", "Y/M/D h:m:g", "Y-M-D h:m:g".
@ eInt8
Convertible into an integer number (Int8 only)
@ k_EType_Size
For internal use 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)
@ eString
An arbitrary string.
@ 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.
@ fHideFullVersion
Hide full version description.
@ fHideConffile
Hide configuration file description.
@ fHideHelp
Hide help description.
@ fHideXmlHelp
Hide XML help description.
@ fHideLogfile
Hide log file description.
@ fHideVersion
Hide version description.
@ fHideFullHelp
Hide full help description.
@ fHideDryRun
Hide dryrun description.
@ ePositionalMode_Loose
Loose mode.
@ eLower
Lowercase characters.
@ eAlnum
Alphanumeric characters.
@ eGraph
Graphical characters.
@ ePrint
Printable characters.
@ eSpace
Space characters.
@ eUser
User defined characters using constructor with string&.
@ 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)
@ fTruncate
Open file in truncate mode.
@ fAppend
Open file in append mode.
@ fBinary
Open file in binary mode.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
void Shift(int n=1)
Delete arguments from 1 to n.
const string & Get(const string &name, bool *found=NULL) const
Get environment value by name.
SIZE_TYPE Size(void) const
Get size (number) of arguments.
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
#define NCBI_RETHROW(prev_exception, exception_class, err_code, message)
Generic macro to re-throw an exception.
string GetDir(EIfEmptyPath mode=eIfEmptyPath_Current) const
Get the directory component for this directory entry.
virtual bool Exists(void) const
Check the entry existence.
bool CreatePath(TCreateFlags flags=fCreate_Default) const
Create the directory path recursively possibly more than one at a time.
void Reset(void)
Reset reference object.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
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::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::iostream CNcbiIostream
Portable alias for iostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
IO_PREFIX::fstream CNcbiFstream
Portable alias for fstream.
static bool StringToBool(const CTempString str)
Convert string to bool.
NCBI_NS_STD::string::size_type SIZE_TYPE
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static Uint8 StringToUInt8_DataSize(const CTempString str, TStringToNumFlags flags=0)
Convert string that can contain "software" qualifiers to Uint8.
static const string BoolToString(bool value)
Convert bool to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static int strcasecmp(const char *s1, const char *s2)
Case-insensitive comparison of two zero-terminated strings.
static CStringUTF8 AsUTF8(const CTempString &src, EEncoding encoding, EValidate validate=eNoValidate)
Convert into UTF8 from a C/C++ string.
static list< string > & WrapList(const list< string > &l, SIZE_TYPE width, const string &delim, list< string > &arr, TWrapFlags flags=0, const string *prefix=0, const string *prefix1=0)
Wrap the list using the specified criteria.
static string XmlEncode(const CTempString str, TXmlEncode flags=eXmlEnc_Contents)
Encode a string for XML.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static void TrimSuffixInPlace(string &str, const CTempString suffix, ECase use_case=eCase)
Trim suffix from a string (in-place)
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
ECase
Which type of string comparison.
static void Wrap(const string &str, SIZE_TYPE width, IWrapDest &dest, TWrapFlags flags, const string *prefix, const string *prefix1)
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
@ fDecimalPosixOrLocal
StringToDouble*(): For decimal point, try both C and current locale.
@ fWrap_Hyphenate
Add a hyphen when breaking words?
@ eNocase
Case insensitive compare.
@ eGmt
GMT (Greenwich Mean Time)
@ fMatch_Weak
Combination of both modes above.
@ fFormat_Simple
Use single characters as format symbols.
#define INVALID_HANDLE_VALUE
A value for an invalid file handle.
#define HANDLE
An abstraction for a file handle.
unsigned int
A callback function used to compare two keys in a database.
Definition of all error codes used in corelib (xncbi.lib).
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
constexpr bool empty(list< Ts... >) noexcept
const GenericPointer< typename T::ValueType > T2 value
int strcmp(const char *str1, const char *str2)
Defines MS Windows specifics for our "C++" code.
#define THROW_CArg_ExcludedValue
void s_WriteXmlLine(CNcbiOstream &out, const string &tag, const string &data)
const char * s_ArgFullVersionXml
const char * s_ArgFullVersionJson
const char * s_ArgFullVersion
static string s_CArgs_ReadFromFile(const string &name, const string &filename)
static string s_CArgs_ReadFromStdin(const string &name, EEchoInput echo_input, const char *cue)
static const char * s_AutoHelp
static const char * s_AutoHelpXml
bool s_IsArgNameChar(char c)
static const char * s_AutoHelpShowAll
static string s_GetSymbolClass(CArgAllow_Symbols::ESymbolClass symbol_class)
string s_KeyUsageSynopsis(const string &name, const string &synopsis, bool name_only, CArgDescriptions::TFlags flags)
static void s_PrintCommentBody(list< string > &arr, const string &s, SIZE_TYPE width)
const char * s_ArgLogFile
bool s_IsPositional(const CArgDesc &arg)
const char * s_ArgCfgFile
static const char * s_ExtraName
Int8 s_StringToInt8(const string &value)
bool s_IsAllowedSymbol(unsigned char ch, CArgAllow_Symbols::ESymbolClass symbol_class, const string &symbol_set)
bool s_IsOptional(const CArgDesc &arg)
bool s_IsAlias(const CArgDesc &arg)
#define THROW_CArg_NoValue
bool s_IsKey(const CArgDesc &arg)
static string s_ComposeNameExtra(size_t idx)
string s_ArgExptMsg(const string &name, const string &what, const string &attr)
bool operator<(const AutoPtr< CArgDesc > &x, const AutoPtr< CArgDesc > &y)
void s_WriteEscapedStr(CNcbiOstream &out, const char *s)
static const char * s_AutoHelpFull
static string s_CArgs_ReadFromConsole(const string &name, EEchoInput echo_input, const char *cue)
bool s_IsFlag(const CArgDesc &arg)
static string s_GetUsageSymbol(CArgAllow_Symbols::ESymbolClass symbol_class, const string &symbol_set)
#define CHECK_STANDARD_ARG(func)
const char * s_ArgVersion
bool s_IsOpening(const CArgDesc &arg)
const char * s_ArgDelimiter
Defines command line argument related classes.
Defines unified interface to application:
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
bool eq(T x_, T y_, T round_)
std::istream & in(std::istream &in_, double &x_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
int g(Seg_Gsm *spe, Seq_Mtf *psm, Thd_Gsm *tdg)
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