Ookii.CommandLine for C++  2.0.0
command_line_generated.h
Go to the documentation of this file.
1 #ifndef OOKII_COMMAND_LINE_GENERATED_H_
4 #define OOKII_COMMAND_LINE_GENERATED_H_
5 
6 #pragma once
7 
8 #include "command_line.h"
9 
17 #define OOKII_DECLARE_CREATE_BUILDER_METHOD_EX(char_type) \
18  ::ookii::basic_parser_builder<char_type> create_builder(::std::basic_string<char_type> command_name, \
19  ::ookii::basic_localized_string_provider<char_type> *string_provider = nullptr, const std::locale &locale = {})
20 
30 #define OOKII_GENERATED_METHODS_EX(type, char_type) \
31  static ::std::optional<type> parse(int argc, const char_type* const argv[], ::ookii::basic_usage_writer<char_type> *usage = nullptr, \
32  ::ookii::basic_localized_string_provider<char_type> *string_provider = nullptr, const std::locale &locale = {}) \
33  { \
34  auto name = ::ookii::basic_command_line_parser<char_type>::get_executable_name(argc, argv); \
35  type args{}; \
36  auto parser = args.create_builder(name, string_provider, locale).build(); \
37  if (parser.parse(argc, argv, usage)) \
38  { \
39  return args; \
40  } \
41  return {}; \
42  } \
43  OOKII_DECLARE_CREATE_BUILDER_METHOD_EX(char_type)
44 
52 #define OOKII_DECLARE_CREATE_BUILDER_METHOD() OOKII_DECLARE_CREATE_BUILDER_METHOD_EX(ookii::details::default_char_type)
53 
64 #define OOKII_GENERATED_METHODS(type) OOKII_GENERATED_METHODS_EX(type, ookii::details::default_char_type)
65 
66 namespace ookii
67 {
82  std::basic_string<details::default_char_type> application_name,
84  const std::locale& locale = {});
85 }
86 
87 #endif
Manages registration, creation and invocation of subcommands for an application.
Definition: subcommand.h:313
Provides custom localized strings.
Definition: localized_string_provider.h:30
This header includes all the main Ookii.CommandLine.Cpp functionality.
Namespace containing the core Ookii.CommandLine.Cpp types.
Definition: command_line_argument.h:16
basic_command_manager< details::default_char_type > register_commands(std::basic_string< details::default_char_type > application_name, basic_localized_string_provider< details::default_char_type > *string_provider=nullptr, const std::locale &locale={})
Function that registers all the subcommands generated by New-Subcommand.ps1.