Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gnsstk::CommandOptionWithPositionArg Class Reference

Detailed Description

Command-line option class for processing position strings. This class allows the programmer to add command-line options to an application that can parse strings containing representations of position. The programmer must specify the format to be accepted. Refer to Position::printf() for details on the formatting specifications.

Definition at line 62 of file CommandOptionWithPositionArg.hpp.

#include <CommandOptionWithPositionArg.hpp>

Inheritance diagram for gnsstk::CommandOptionWithPositionArg:
Inheritance graph
[legend]

Public Member Functions

virtual std::string checkArguments ()
 Validate arguments passed using this option (and store them). More...
 
 CommandOptionWithPositionArg (const char shOpt, const std::string &loOpt, const std::string &posFormat, const std::string &desc, const bool required=false)
 
virtual std::string getArgString () const
 
std::vector< PositiongetPosition () const
 Return the positions scanned in from the command line. More...
 
virtual ~CommandOptionWithPositionArg ()
 Destructor. More...
 
- Public Member Functions inherited from gnsstk::CommandOptionWithAnyArg
 CommandOptionWithAnyArg (const char shOpt, const std::string &loOpt, const std::string &desc, const bool required=false)
 Constructor. More...
 
virtual ~CommandOptionWithAnyArg ()
 Destructor. More...
 
- Public Member Functions inherited from gnsstk::CommandOptionWithArg
 CommandOptionWithArg (const CommandOptionType ot, const char shOpt, const std::string &loOpt, const std::string &desc, const bool required=false)
 Constructor. More...
 
virtual ~CommandOptionWithArg ()
 Destructor. More...
 
- Public Member Functions inherited from gnsstk::CommandOption
 CommandOption (const CommandOptionFlag of, const CommandOptionType ot, const char shOpt, const std::string &loOpt, const std::string &desc, const bool req=false, CommandOptionVec &optVectorList=defaultCommandOptionList)
 
std::ostream & dumpValue (std::ostream &out) const
 Displays this->value to the stream out. More...
 
virtual unsigned long getCount () const
 
std::string getDescription () const
 Returns a formatted string with the description of this option. More...
 
std::string getFullOptionString () const
 
virtual std::string getOptionString () const
 
unsigned long getOrder (unsigned long idx=-1) const
 
const std::vector< std::string > & getValue () const
 
void setDescription (const std::string &desc)
 
CommandOptionsetMaxCount (const unsigned long l)
 
struct option toGetoptLongOption () const
 Returns a struct option for use with getopt_long. More...
 
std::string toGetoptShortOption () const
 Returns a string for use with getopt. More...
 
virtual ~CommandOption ()
 Destructor. More...
 

Protected Member Functions

 CommandOptionWithPositionArg ()
 Default Constructor. More...
 
virtual std::string getPositionSpec (std::vector< std::string >::size_type index) const
 Return the appropriate position scanning format for value[index]. More...
 
- Protected Member Functions inherited from gnsstk::CommandOptionWithAnyArg
 CommandOptionWithAnyArg ()
 Default Constructor. More...
 
- Protected Member Functions inherited from gnsstk::CommandOptionWithArg
 CommandOptionWithArg ()
 Default Constructor. More...
 
- Protected Member Functions inherited from gnsstk::CommandOption
 CommandOption ()
 Default Constructor. More...
 

Protected Attributes

std::vector< Positionpositions
 Collection of positions scanned in from the command line. More...
 
std::string posSpec
 Format used to scan positions in. More...
 
- Protected Attributes inherited from gnsstk::CommandOption
unsigned long count
 
std::string description
 The description for the help text. More...
 
std::string longOpt
 The string for the long option (for example, "--foo"). More...
 
unsigned long maxCount
 
CommandOptionFlag optFlag
 Flag for determining whether this option has an argument or not. More...
 
CommandOptionType optType
 
std::vector< unsigned long > order
 The order in which this option was encountered on the command line. More...
 
CommandOptionParserparser
 
bool required
 Whether or not this is a required command line option. More...
 
char shortOpt
 The character for the short option (for example, '-f'). More...
 
std::vector< std::string > value
 Any arguments passed with this option get put in here. More...
 

Additional Inherited Members

- Public Types inherited from gnsstk::CommandOption
enum  CommandOptionFlag { noArgument = 0, hasArgument = 1 }
 
enum  CommandOptionType { trailingType, stdType, metaType }
 

Constructor & Destructor Documentation

◆ CommandOptionWithPositionArg() [1/2]

gnsstk::CommandOptionWithPositionArg::CommandOptionWithPositionArg ( const char  shOpt,
const std::string &  loOpt,
const std::string &  posFormat,
const std::string &  desc,
const bool  required = false 
)
inline

Constructor

Parameters
shOptThe one character command line option. Set to 0 if unused.
loOptThe long command option. Set to std::string() if unused.
posFormatformat for scanning argument into a Position (
See also
Position::setToString() for details).
Parameters
descA string describing what this option does.
requiredSet to true if this is a required option.

Definition at line 75 of file CommandOptionWithPositionArg.hpp.

◆ ~CommandOptionWithPositionArg()

virtual gnsstk::CommandOptionWithPositionArg::~CommandOptionWithPositionArg ( )
inlinevirtual

Destructor.

Definition at line 85 of file CommandOptionWithPositionArg.hpp.

◆ CommandOptionWithPositionArg() [2/2]

gnsstk::CommandOptionWithPositionArg::CommandOptionWithPositionArg ( )
inlineprotected

Default Constructor.

Definition at line 109 of file CommandOptionWithPositionArg.hpp.

Member Function Documentation

◆ checkArguments()

string gnsstk::CommandOptionWithPositionArg::checkArguments ( )
virtual

Validate arguments passed using this option (and store them).

Reimplemented from gnsstk::CommandOption.

Definition at line 51 of file CommandOptionWithPositionArg.cpp.

◆ getArgString()

virtual std::string gnsstk::CommandOptionWithPositionArg::getArgString ( ) const
inlinevirtual

Returns a string with the argument format (just "POSITION", not scanning format).

Reimplemented from gnsstk::CommandOption.

Definition at line 91 of file CommandOptionWithPositionArg.hpp.

◆ getPosition()

std::vector<Position> gnsstk::CommandOptionWithPositionArg::getPosition ( ) const
inline

Return the positions scanned in from the command line.

Definition at line 98 of file CommandOptionWithPositionArg.hpp.

◆ getPositionSpec()

virtual std::string gnsstk::CommandOptionWithPositionArg::getPositionSpec ( std::vector< std::string >::size_type  index) const
inlineprotectedvirtual

Return the appropriate position scanning format for value[index].

Definition at line 114 of file CommandOptionWithPositionArg.hpp.

Member Data Documentation

◆ positions

std::vector<Position> gnsstk::CommandOptionWithPositionArg::positions
protected

Collection of positions scanned in from the command line.

Definition at line 103 of file CommandOptionWithPositionArg.hpp.

◆ posSpec

std::string gnsstk::CommandOptionWithPositionArg::posSpec
protected

Format used to scan positions in.

Definition at line 106 of file CommandOptionWithPositionArg.hpp.


The documentation for this class was generated from the following files:


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:44