Builder for CliContext objects, allowing to incrementally add arguments before constructing the final context object.  
 More...
#include <context_builder.h>
Builder for CliContext objects, allowing to incrementally add arguments before constructing the final context object. 
◆ addFlagArgument() [1/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addFlagArgument | ( | const std::string & | argName | ) |  | 
      
 
Add a flag argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the flag argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addFlagArgument() [2/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addFlagArgument | ( | std::string_view | argName | ) |  | 
      
 
Add a flag argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the flag argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addOptionArgument() [1/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addOptionArgument | ( | const std::string & | argName, | 
        
          |  |  | std::any & | val | 
        
          |  | ) |  |  | 
      
 
Add an optional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the optional argument |  | val | value of the optional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addOptionArgument() [2/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addOptionArgument | ( | std::string_view | argName, | 
        
          |  |  | std::any & | val | 
        
          |  | ) |  |  | 
      
 
Add an optional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the optional argument |  | val | value of the optional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addPositionalArgument() [1/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addPositionalArgument | ( | const std::string & | argName, | 
        
          |  |  | std::any & | val | 
        
          |  | ) |  |  | 
      
 
Add a positional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the positional argument |  | val | value of the positional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addPositionalArgument() [2/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addPositionalArgument | ( | std::string_view | argName, | 
        
          |  |  | std::any & | val | 
        
          |  | ) |  |  | 
      
 
Add a positional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the positional argument |  | val | value of the positional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addRepeatableOptionArgument() [1/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addRepeatableOptionArgument | ( | const std::string & | argName, | 
        
          |  |  | const std::vector< std::any > & | vals | 
        
          |  | ) |  |  | 
      
 
Add a repeatable optional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the repeatable optional argument |  | vals | values of the repeatable optional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addRepeatableOptionArgument() [2/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addRepeatableOptionArgument | ( | std::string_view | argName, | 
        
          |  |  | const std::vector< std::any > & | vals | 
        
          |  | ) |  |  | 
      
 
Add a repeatable optional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the repeatable optional argument |  | vals | values of the repeatable optional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addRepeatablePositionalArgument() [1/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addRepeatablePositionalArgument | ( | const std::string & | argName, | 
        
          |  |  | const std::vector< std::any > & | vals | 
        
          |  | ) |  |  | 
      
 
Add a repeatable positional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the repeatable positional argument |  | vals | values of the repeatable positional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ addRepeatablePositionalArgument() [2/2]
      
        
          | inline_t ContextBuilder & cli::ContextBuilder::addRepeatablePositionalArgument | ( | std::string_view | argName, | 
        
          |  |  | const std::vector< std::any > & | vals | 
        
          |  | ) |  |  | 
      
 
Add a repeatable positional argument to the context being built. 
- Parameters
- 
  
    | argName | the name of the repeatable positional argument |  | vals | values of the repeatable positional argument |  
 
- Returns
- a reference to this ContextBuilder instance 
 
 
◆ build()
Builds the final CliContext object from the accumulated arguments. 
- Parameters
- 
  
    | logger | the logger instance to use in the created context |  
 
- Returns
- a unique_ptr to the created CliContext object 
 
 
◆ isArgPresent()
      
        
          | inline_t bool cli::ContextBuilder::isArgPresent | ( | const std::string & | argName | ) | const | 
      
 
Checks if an argument with the given name is present in the context being built. 
- Parameters
- 
  
    | argName | the name of the argument to search for |  
 
- Returns
- true if the argument is present, false otherwise 
 
 
The documentation for this class was generated from the following files: