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

Program options. More...

#include <app.hpp>

Inheritance diagram for fpsdk::common::app::ProgramOptions:
Collaboration diagram for fpsdk::common::app::ProgramOptions:

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 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.
 

Public Attributes

std::string app_name_
 App name.
 
logging::LoggingLevel logging_ = logging::LoggingLevel::INFO
 Logging verbosity level.
 
std::vector< std::string > argv_
 argv[] of program
 

Static Public Attributes

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

Detailed Description

Program options.

Definition at line 114 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

◆ PrintHelp()

virtual void fpsdk::common::app::ProgramOptions::PrintHelp ( )
pure virtual

Print the help screen and exit(0)

Implemented in fpsdk::apps::fpltool::FplToolOptions.

◆ 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]argumentOptional argument
Returns
true if option was accepted, false otherwise

Implemented in fpsdk::apps::fpltool::FplToolOptions.

◆ CheckOptions()

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

Check options, and handle non-flag arguments.

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

Reimplemented in fpsdk::apps::fpltool::FplToolOptions.

Definition at line 167 of file app.hpp.

Member Data Documentation

◆ COMMON_FLAGS_HELP

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

Help screen for common options.

Definition at line 174 of file app.hpp.

Referenced by fpsdk::apps::fpltool::FplToolOptions::PrintHelp().

◆ app_name_

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

App name.

Definition at line 179 of file app.hpp.

◆ logging_

logging::LoggingLevel fpsdk::common::app::ProgramOptions::logging_ = logging::LoggingLevel::INFO

Logging verbosity level.

Definition at line 180 of file app.hpp.

◆ argv_

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

argv[] of program

Definition at line 181 of file app.hpp.


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