Fixposition SDK 0.0.0-heads/main-0-g4e80ed3
Collection of c++ libraries and apps for use with Fixposition products on Linux
Loading...
Searching...
No Matches
fpsdk::common::app::ProgramOptions Class Referenceabstract

Program options. More...

#include <app.hpp>

Collaboration diagram for fpsdk::common::app::ProgramOptions:
[legend]

Classes

struct  Option
 A program option. More...
 

Public Member Functions

 ProgramOptions (const std::string &app_name, const std::vector< Option > &options)
 Constructor.
 
virtual ~ProgramOptions ()
 Destructor.
 
bool LoadFromArgv (int argc, char **argv)
 Load arguments from argv[].
 
virtual void PrintHelp ()=0
 Print the help screen and exit(0)
 
virtual void PrintVersion ()
 Print version information.
 
virtual bool HandleOption (const Option &option, const std::string &argument)=0
 Handle a command-line flag argument.
 
virtual bool CheckOptions (const std::vector< std::string > &args)
 Check options, and handle non-flag arguments.
 

Protected Attributes

std::string app_name_
 App name.
 
logging::LoggingParams logging_params_
 Logging params.
 
std::vector< std::string > argv_
 argv[] of program
 

Static Protected Attributes

static constexpr const char * COMMON_FLAGS_HELP
 Help screen for common options.
 

Detailed Description

Program options.

Definition at line 160 of file app.hpp.

Member Function Documentation

◆ LoadFromArgv()

bool fpsdk::common::app::ProgramOptions::LoadFromArgv ( int argc,
char ** argv )

Load arguments from argv[].

Parameters
[in,out]argcNumber of arguments
[in,out]argvCommand-line arguments
Returns

◆ HandleOption()

virtual bool fpsdk::common::app::ProgramOptions::HandleOption ( const Option & option,
const std::string & argument )
pure virtual

Handle a command-line flag argument.

Parameters
[in]optionThe option
[in]argumentOption argument (if the option requires one)
Returns
true if option was accepted, false otherwise

◆ CheckOptions()

virtual bool fpsdk::common::app::ProgramOptions::CheckOptions ( const std::vector< std::string > & args)
virtual

Check options, and handle non-flag arguments.

Parameters
[in]argsThe non-flag arguments
Returns
true if options are good, false otherwise

Member Data Documentation

◆ COMMON_FLAGS_HELP

const char* fpsdk::common::app::ProgramOptions::COMMON_FLAGS_HELP
staticconstexprprotected

Help screen for common options.

Definition at line 226 of file app.hpp.

◆ app_name_

std::string fpsdk::common::app::ProgramOptions::app_name_
protected

App name.

Definition at line 233 of file app.hpp.

◆ logging_params_

logging::LoggingParams fpsdk::common::app::ProgramOptions::logging_params_
protected

Logging params.

Definition at line 234 of file app.hpp.

◆ argv_

std::vector<std::string> fpsdk::common::app::ProgramOptions::argv_
protected

argv[] of program

Definition at line 235 of file app.hpp.


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