NCBI C++ ToolKit
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members

Search Toolkit Book for CArgs

CArgs –. More...

#include <corelib/ncbiargs.hpp>

+ Collaboration diagram for CArgs:

Public Member Functions

 CArgs (void)
 Constructor. More...
 
 ~CArgs (void)
 Destructor. More...
 
 CArgs (const CArgs &other)
 Creating copy of this object usually makes no sense if it is really required, please use Assign method. More...
 
CArgsoperator= (const CArgs &other)
 Creating copy of this object usually makes no sense if it is really required, please use Assign method. More...
 
CArgsAssign (const CArgs &other)
 Copy contents of another object into this one. More...
 
bool Exist (const string &name) const
 Check existence of argument description. More...
 
const CArgValueoperator[] (const string &name) const
 Get value of argument by name. More...
 
size_t GetNExtra (void) const
 Get the number of unnamed positional (a.k.a. extra) args. More...
 
const CArgValueoperator[] (size_t idx) const
 Return N-th extra arg value, N = 1 to GetNExtra(). More...
 
vector< CRef< CArgValue > > GetAll (void) const
 Get all available arguments. More...
 
stringPrint (string &str) const
 Print (append) all arguments to the string "str" and return "str". More...
 
void Add (CArgValue *arg, bool update=false, bool add_value=false)
 Add new argument name and value. More...
 
bool IsEmpty (void) const
 Check if there are no arguments in this container. More...
 
void Remove (const string &name)
 Remove argument of name "name". More...
 
void Reset (void)
 Remove all arguments. More...
 
string GetCommand (void) const
 Get current command. More...
 

Protected Member Functions

CArgsSetCommand (const string &command)
 Set current command. More...
 

Private Types

typedef set< CRef< CArgValue > > TArgs
 Type for arguments. More...
 
typedef TArgs::iterator TArgsI
 Type for iterator. More...
 
typedef TArgs::const_iterator TArgsCI
 Type for const iterator. More...
 

Private Member Functions

TArgsCI x_Find (const string &name) const
 Find argument value with name "name". More...
 
TArgsI x_Find (const string &name)
 

Private Attributes

TArgs m_Args
 Assoc. map of arguments' name/value. More...
 
size_t m_nExtra
 Cached # of unnamed positional arguments. More...
 
string m_Command
 

Friends

class CCommandArgDescriptions
 

Detailed Description

CArgs –.

Defines parsed arguments.

Argument values are obtained from the unprocessed command-line arguments (via CNcbiArguments) and then verified and processed according to the argument descriptions defined by user in "CArgDescriptions".

NOTE: the extra arguments can be accessed using virtual names: "#1", "#2", "#3", ..., "#<GetNExtra()>" in the order of insertion (by method Add).

Definition at line 378 of file ncbiargs.hpp.


The documentation for this class was generated from the following files:
Modified on Sat Apr 13 11:48:29 2024 by modify_doxy.py rev. 669887