Sequoia
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
CommandLineArguments.hpp File Reference

Parsing of commandline arguments. More...

#include "sequoia/Core/Meta/Concepts.hpp"
#include "sequoia/Maths/Graph/DynamicTree.hpp"
#include "sequoia/Maths/Graph/GraphTraversalFunctions.hpp"
#include <vector>
#include <string>
#include <functional>
#include <stdexcept>

Go to the source code of this file.

Classes

class  sequoia::parsing::commandline::proper_string
 Class which wraps a std::string and enforces the invariant that the std::string be non-empty. More...
 
struct  sequoia::parsing::commandline::option
 Used to specify a forest of options, against which the runtime commandline arguments are parsed. More...
 
struct  sequoia::parsing::commandline::operation
 Used to build a forest of operations which will be invoked at the end of the parsing process. More...
 
struct  sequoia::parsing::commandline::outcome
 The result of parsing command line arguments to build an operation forest. More...
 
class  sequoia::parsing::commandline::argument_parser
 Parses command line arguments, building outcome from an option forest. More...
 

Typedefs

using sequoia::parsing::commandline::param_list = std::vector< proper_string >
 
using sequoia::parsing::commandline::arg_list = std::vector< std::string >
 
using sequoia::parsing::commandline::executor = std::function< void(const arg_list &)>
 
using sequoia::parsing::commandline::options_tree = maths::directed_tree< maths::tree_link_direction::forward, maths::null_weight, option >
 
using sequoia::parsing::commandline::options_forest = std::vector< options_tree >
 
using sequoia::parsing::commandline::option_tree = maths::const_tree_adaptor< options_tree >
 
using sequoia::parsing::commandline::operations_tree = maths::directed_tree< maths::tree_link_direction::forward, maths::null_weight, operation >
 
using sequoia::parsing::commandline::operations_sub_tree = maths::tree_adaptor< operations_tree >
 
using sequoia::parsing::commandline::operations_forest = std::vector< operations_tree >
 

Functions

std::string sequoia::parsing::commandline::error (std::string_view message, std::string_view indent)
 
std::string sequoia::parsing::commandline::error (std::initializer_list< std::string_view > messages, std::string_view indent)
 
std::string sequoia::parsing::commandline::warning (std::string_view message, std::string_view indent)
 
std::string sequoia::parsing::commandline::warning (std::initializer_list< std::string_view > messages, std::string_view indent)
 
std::string sequoia::parsing::commandline::pluralize (const std::size_t n, std::string_view noun, std::string_view prefix)
 
outcome sequoia::parsing::commandline::parse (int argc, char **argv, const options_forest &options)
 
template<std::invocable< std::string > Fn>
std::string sequoia::parsing::commandline::parse_invoke_depth_first (int argc, char **argv, const options_forest options, Fn zerothArgProcessor)
 

Detailed Description

Parsing of commandline arguments.

The philosophy is to specify a forest whose nodes are instance of sequoia::parsing::commandline::option. This is used at runtime, as the command line arguments are parsed to generate a forest whose nodes are instances of sequoia::parsing::commandline::operation. This tree is then traversed, and the function objects held by the operations invoked.