NCBI C++ ToolKit
Classes | Macros | Enumerations | Functions | Variables
ncbiargs.cpp File Reference
#include <ncbi_pch.hpp>
#include <corelib/ncbiapp_api.hpp>
#include <corelib/ncbiargs.hpp>
#include <corelib/ncbienv.hpp>
#include <corelib/ncbifile.hpp>
#include <corelib/error_codes.hpp>
#include <algorithm>
#include <corelib/ncbi_os_mswin.hpp>
#include <io.h>
#include <fcntl.h>
#include <conio.h>
#include "ncbiargs_p.hpp"
+ Include dependency graph for ncbiargs.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CArgDesc_NameOnly
 

Macros

#define NCBI_USE_ERRCODE_X   Corelib_Config
 
#define NCBIARGS__CPP
 
#define THROW_CArg_NoValue
 
#define THROW_CArg_ExcludedValue
 

Enumerations

enum  EEchoInput { eNoEcho , eEchoInput }
 

Functions

string s_ArgExptMsg (const string &name, const string &what, const string &attr)
 
void s_WriteEscapedStr (CNcbiOstream &out, const char *s)
 
void s_WriteXmlLine (CNcbiOstream &out, const string &tag, const string &data)
 
Int8 s_StringToInt8 (const string &value)
 
bool s_IsKey (const CArgDesc &arg)
 
bool s_IsPositional (const CArgDesc &arg)
 
bool s_IsOpening (const CArgDesc &arg)
 
bool s_IsOptional (const CArgDesc &arg)
 
bool s_IsFlag (const CArgDesc &arg)
 
bool s_IsAlias (const CArgDesc &arg)
 
bool operator< (const AutoPtr< CArgDesc > &x, const AutoPtr< CArgDesc > &y)
 
string s_KeyUsageSynopsis (const string &name, const string &synopsis, bool name_only, CArgDescriptions::TFlags flags)
 
static string s_ComposeNameExtra (size_t idx)
 
bool s_IsArgNameChar (char c)
 
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 string s_CArgs_ReadFromConsole (const string &name, EEchoInput echo_input, const char *cue)
 
static void s_PrintCommentBody (list< string > &arr, const string &s, SIZE_TYPE width)
 
bool s_IsAllowedSymbol (unsigned char ch, CArgAllow_Symbols::ESymbolClass symbol_class, const string &symbol_set)
 
static string s_GetUsageSymbol (CArgAllow_Symbols::ESymbolClass symbol_class, const string &symbol_set)
 
static string s_GetSymbolClass (CArgAllow_Symbols::ESymbolClass symbol_class)
 

Variables

static const char * s_AutoHelp = "h"
 
static const char * s_AutoHelpFull = "help"
 
static const char * s_AutoHelpShowAll = "help-full"
 
static const char * s_AutoHelpXml = "xmlhelp"
 
static const char * s_ExtraName = "...."
 
const char * s_ArgLogFile = "-logfile"
 
const char * s_ArgCfgFile = "-conffile"
 
const char * s_ArgVersion = "-version"
 
const char * s_ArgFullVersion = "-version-full"
 
const char * s_ArgFullVersionXml = "-version-full-xml"
 
const char * s_ArgFullVersionJson = "-version-full-json"
 
const char * s_ArgDryRun = "-dryrun"
 
const char * s_ArgDelimiter = "--"
 

Macro Definition Documentation

◆ NCBI_USE_ERRCODE_X

#define NCBI_USE_ERRCODE_X   Corelib_Config

Definition at line 57 of file ncbiargs.cpp.

◆ NCBIARGS__CPP

#define NCBIARGS__CPP

Definition at line 67 of file ncbiargs.cpp.

◆ THROW_CArg_ExcludedValue

#define THROW_CArg_ExcludedValue
Value:
NCBI_THROW(CArgException,eExcludedValue, s_ArgExptMsg(GetName(), \
"The value is excluded by other arguments.", ""));
CArgException –.
Definition: ncbiargs.hpp:120
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
string s_ArgExptMsg(const string &name, const string &what, const string &attr)
Definition: ncbiargs.cpp:95

Definition at line 245 of file ncbiargs.cpp.

◆ THROW_CArg_NoValue

#define THROW_CArg_NoValue
Value:
NCBI_THROW(CArgException,eNoValue, s_ArgExptMsg(GetName(), \
"The argument has no value", ""));

Definition at line 207 of file ncbiargs.cpp.

Enumeration Type Documentation

◆ EEchoInput

enum EEchoInput
Enumerator
eNoEcho 
eEchoInput 

Definition at line 1960 of file ncbiargs.cpp.

Function Documentation

◆ operator<()

bool operator< ( const AutoPtr< CArgDesc > &  x,
const AutoPtr< CArgDesc > &  y 
)
inline

Definition at line 983 of file ncbiargs.cpp.

References CArgDesc::GetName().

◆ s_ArgExptMsg()

string s_ArgExptMsg ( const string name,
const string what,
const string attr 
)
inline

◆ s_CArgs_ReadFromConsole()

static string s_CArgs_ReadFromConsole ( const string name,
EEchoInput  echo_input,
const char *  cue 
)
static

Definition at line 2062 of file ncbiargs.cpp.

References _TX, buffer, close(), ECHO, eNoEcho, HANDLE, i, INVALID_HANDLE_VALUE, NULL, and value.

◆ s_CArgs_ReadFromFile()

static string s_CArgs_ReadFromFile ( const string name,
const string filename 
)
static

Definition at line 1965 of file ncbiargs.cpp.

References copy(), f(), CArgDescriptions::fBinary, string, and value.

◆ s_CArgs_ReadFromStdin()

static string s_CArgs_ReadFromStdin ( const string name,
EEchoInput  echo_input,
const char *  cue 
)
static

Definition at line 1978 of file ncbiargs.cpp.

References buffer, ECHO, eNoEcho, HANDLE, INVALID_HANDLE_VALUE, NULL, STDIN_FILENO, and value.

◆ s_ComposeNameExtra()

static string s_ComposeNameExtra ( size_t  idx)
static

Definition at line 1780 of file ncbiargs.cpp.

References NStr::UInt8ToString().

Referenced by CArgs::Add(), and CArgs::operator[]().

◆ s_GetSymbolClass()

static string s_GetSymbolClass ( CArgAllow_Symbols::ESymbolClass  symbol_class)
static

◆ s_GetUsageSymbol()

static string s_GetUsageSymbol ( CArgAllow_Symbols::ESymbolClass  symbol_class,
const string symbol_set 
)
static

◆ s_IsAlias()

bool s_IsAlias ( const CArgDesc arg)
inline

◆ s_IsAllowedSymbol()

bool s_IsAllowedSymbol ( unsigned char  ch,
CArgAllow_Symbols::ESymbolClass  symbol_class,
const string symbol_set 
)
inline

◆ s_IsArgNameChar()

bool s_IsArgNameChar ( char  c)
inline

Definition at line 1786 of file ncbiargs.cpp.

References isalnum().

Referenced by CArgDescriptions::VerifyName(), and CArgs::x_Find().

◆ s_IsFlag()

bool s_IsFlag ( const CArgDesc arg)
inline

◆ s_IsKey()

bool s_IsKey ( const CArgDesc arg)
inline

◆ s_IsOpening()

bool s_IsOpening ( const CArgDesc arg)
inline

◆ s_IsOptional()

bool s_IsOptional ( const CArgDesc arg)
inline

◆ s_IsPositional()

bool s_IsPositional ( const CArgDesc arg)
inline

◆ s_KeyUsageSynopsis()

string s_KeyUsageSynopsis ( const string name,
const string synopsis,
bool  name_only,
CArgDescriptions::TFlags  flags 
)
inline

◆ s_PrintCommentBody()

static void s_PrintCommentBody ( list< string > &  arr,
const string s,
SIZE_TYPE  width 
)
static

◆ s_StringToInt8()

Int8 s_StringToInt8 ( const string value)
inline

◆ s_WriteEscapedStr()

void s_WriteEscapedStr ( CNcbiOstream out,
const char *  s 
)
inline

Definition at line 102 of file ncbiargs.cpp.

References out(), and NStr::XmlEncode().

Referenced by CArgDesc::PrintXml(), and s_WriteXmlLine().

◆ s_WriteXmlLine()

void s_WriteXmlLine ( CNcbiOstream out,
const string tag,
const string data 
)

Variable Documentation

◆ s_ArgCfgFile

const char* s_ArgCfgFile = "-conffile"

◆ s_ArgDelimiter

const char* s_ArgDelimiter = "--"

Definition at line 89 of file ncbiargs.cpp.

Referenced by CNcbiApplicationAPI::AppMain(), and CArgDescriptions::x_CreateArg().

◆ s_ArgDryRun

const char* s_ArgDryRun = "-dryrun"

Definition at line 88 of file ncbiargs.cpp.

Referenced by CArgDescriptions::AddStdArguments(), and CNcbiApplicationAPI::AppMain().

◆ s_ArgFullVersion

const char* s_ArgFullVersion = "-version-full"

◆ s_ArgFullVersionJson

const char* s_ArgFullVersionJson = "-version-full-json"

Definition at line 87 of file ncbiargs.cpp.

Referenced by CArgDescriptions::AddStdArguments(), and CNcbiApplicationAPI::AppMain().

◆ s_ArgFullVersionXml

const char* s_ArgFullVersionXml = "-version-full-xml"

Definition at line 86 of file ncbiargs.cpp.

Referenced by CArgDescriptions::AddStdArguments(), and CNcbiApplicationAPI::AppMain().

◆ s_ArgLogFile

const char* s_ArgLogFile = "-logfile"

◆ s_ArgVersion

const char* s_ArgVersion = "-version"

◆ s_AutoHelp

const char* s_AutoHelp = "h"
static

◆ s_AutoHelpFull

const char* s_AutoHelpFull = "help"
static

◆ s_AutoHelpShowAll

const char* s_AutoHelpShowAll = "help-full"
static

◆ s_AutoHelpXml

const char* s_AutoHelpXml = "xmlhelp"
static

◆ s_ExtraName

const char* s_ExtraName = "...."
static
Modified on Thu Feb 29 12:16:56 2024 by modify_doxy.py rev. 669887