Scarab  v2.2.3
Project 8 C++ Utility Library
Public Member Functions | List of all members
main_app Class Reference

Primary application class. More...

#include <application.hh>

Inheritance diagram for main_app:
Inheritance graph

Public Member Functions

 main_app ()
 
virtual ~main_app ()
 
virtual void pre_callback ()
 
void set_version (version_semantic *a_ver)
 
 mv_referrable (param_node, master_config)
 
 mv_referrable (param_node, default_config)
 
 mv_referrable_const (std::string, config_filename)
 
 mv_accessible (unsigned, global_verbosity)
 
 mv_referrable (param_node, nonoption_kw_args)
 
 mv_referrable (param_array, nonoption_ord_args)
 
 mv_referrable (param_node, app_options)
 

Detailed Description

Primary application class.

Author
N. S. Oblath
 See CLI11 documentation for the CLI::App class:
 - GitHub Readme: https://github.com/CLIUtils/CLI11
 - Tutorial: https://cliutils.gitlab.io/CLI11Tutorial
 - API: https://cliutils.github.io/CLI11/index.html

 Basic usage (customized from CLI11's basic usage):

 int main( int argc, char **argv )
 {
     main_app the_main;

Add new options/flags here

Set the default config file the_main.default_config() = t_default_config;

This includes calling application::pre_callback() to finalize the global config CLI11_PARSE( the_main, argc, argv );

return 0; }

Notes for setting options in an application:

Stages for setting the configuration

  1. Default options
  2. Config file
  3. Non-option arguments
  4. Application-specified options

In stage 3, arguments can have two forms:

Application specified options are merged with the config and are separately accessible as app_options.

Example: > my_app -c config.yaml –an_opt 20 nested.value="hello"

What happens:

  1. my_app will have default values hard-coded
  2. File config.yaml will be parsed and merged with the defaults
  3. Configuration nested { value: "hello" } will be merged with the config
  4. Option an_opt will set something specified in the config to 20

Definition at line 78 of file application.hh.

Constructor & Destructor Documentation

main_app ( )

Definition at line 21 of file application.cc.

~main_app ( )
virtual

Definition at line 44 of file application.cc.

Member Function Documentation

mv_accessible ( unsigned  ,
global_verbosity   
)
mv_referrable ( param_node  ,
master_config   
)
mv_referrable ( param_node  ,
default_config   
)
mv_referrable ( param_node  ,
nonoption_kw_args   
)
mv_referrable ( param_array  ,
nonoption_ord_args   
)
mv_referrable ( param_node  ,
app_options   
)
mv_referrable_const ( std::string  ,
config_filename   
)
void pre_callback ( )
virtual

parses positional arguments into the global config called after parsing, before running callbacks

Definition at line 53 of file application.cc.

void set_version ( version_semantic a_ver)

Definition at line 48 of file application.cc.


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