ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
clicamp.cpp
1//##################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2025 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6//##################################################################################################
7#include "alib_precompile.hpp"
8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
10#endif
11#if ALIB_C20_MODULES
12 module;
13#endif
14//========================================= Global Fragment ========================================
18//============================================== Module ============================================
19#if ALIB_C20_MODULES
20 module ALib.CLI;
21# if ALIB_STRINGS
22 import ALib.Strings;
23# endif
24# if ALIB_BOXING
25 import ALib.Boxing;
26# endif
27# if ALIB_CAMP
28 import ALib.Camp;
29# endif
30#else
31# include "ALib.Strings.H"
32# include "ALib.Boxing.H"
33# include "ALib.Camp.H"
34# include "ALib.CLI.H"
35#endif
37//========================================== Implementation ========================================
39
40namespace alib {
41
43
44//==================================================================================================
45/// This is the reference documentation of sub-namespace \c cli of the \aliblink, which
46/// holds types of library module \alib_cli_nl.
47///
48/// Besides this reference documentation, further documentation and source code samples for this
49/// module is provided with \ref alib_mod_cli "ALib Module CLI - Programmer's Manual".
50//==================================================================================================
51namespace cli {
52
54: Camp( "CLI" ) {
55 #if ALIB_DEBUG && !ALIB_DEBUG_ASSERTION_PRINTABLES
56 ALIB_ASSERT_ERROR( this == &CLI, "CLI",
57 "Instances of class Cli must not be created. Use singleton alib::CLI" )
58 #endif
59}
60
61#define EOS ,
64
65#if !ALIB_CAMP_OMIT_DEFAULT_RESOURCES
66 resourcePool->BootstrapBulk( ResourceCategory,
67
68 //--------------------------------------- Exceptions -------------------------------------
69 "E<" , A_CHAR( "cli::" ),
70
71 // general exceptions
72 "E0", A_CHAR( "1,NoCommandGiven" ",ED1" ),
73 "E1", A_CHAR( "2,UnknownCommand" ",ED2" ),
74
75 // option parsing exceptions
76 "E2", A_CHAR( "10,ParsingOptions" ",ED10" ),
77 "E3", A_CHAR( "11,MissingOptionValue" ",ED11" ),
78 "E4", A_CHAR( "12,IllegalOptionNameContinuation" ",ED12" ),
79
80 // command parsing exceptions
81 "E5", A_CHAR( "20,ParsingCommand" ",ED20" ),
82 "E6", A_CHAR( "21,MissingParameterValue" ",ED21" ) EOS
83
84 // messages of general exceptions
85 "ED1", A_CHAR( "No command given." ),
86 "ED2", A_CHAR( "Unknown command found with CLI argument{!Q[]}={!Q}" ),
87 "ED10", A_CHAR( "Error parsing option. Usage:\n"
88 "{}" ),
89 "ED20", A_CHAR( "Error parsing command.\n"
90 "Usage: {}\n"
91 "{}" ),
92
93
94 // messages of internal exceptions
95 "ED11", A_CHAR( "Missing argument(s) of option {!Q<>} found with CLI argument{!Q[]}={!Q}.\n"
96 "Expected {}, given {}." ),
97
98 "ED12", A_CHAR( "Option identifier {!Q<>} found at start of CLI argument{!Q[]}={!Q},\n"
99 "while CLI argument string continues with non-argument identifier characters." ),
100
101 "ED21", A_CHAR( "Missing argument(s) of parameter {!Q<>} found with CLI argument{!Q[]}={!Q}.\n"
102 "Quantity expected {}, quantity given {}." ) EOS
103
104
105 //-------------------------------------- DryRunModes -------------------------------------
106 "DRM<", A_CHAR( "DryRunModes::" ),
107DOX_MARKER([DOX_CLI_DRYRUN_RESOURCES])
108"DRM" , A_CHAR( "0" "," "Off" "," "1" ","
109 "2" "," "CLIDeclarations" "," "4" ","
110 "1" "," "CLIArgs" "," "1" ","
111 "3" "," "Application" "," "1" ),
112DOX_MARKER([DOX_CLI_DRYRUN_RESOURCES])
113 // end of BootstrapBulk()
114 nullptr );
115#endif // !ALIB_CAMP_OMIT_DEFAULT_RESOURCES
116
117 // parse enum records
120 }
121
123 {}
125 {}
126
127}
128
129
130}} // namespace alib::cli
NCString ResourceCategory
Definition camp.inl:113
BootstrapPhases GetBootstrapState()
Definition camp.inl:174
Camp(const NCString &resourceCategory)
Definition camp.inl:120
SPResourcePool resourcePool
Definition camp.inl:95
virtual void Bootstrap() override
Initializes this camp.
Definition clicamp.cpp:62
#define ALIB_BOXING_VTABLE_DEFINE(TMapped, Identifier)
#define A_CHAR(STR)
#define ALIB_ASSERT_ERROR(cond, domain,...)
Definition alib.inl:1066
void Bootstrap(camp::Camp &camp, const NString &name, character innerDelim=',', character outerDelim=',')
Definition camp.inl:324
@ Final
The final initialization phase. Here, camps are initializing their custom setup.
Definition camp.inl:35
cli::CliCamp CLI
The singleton instance of ALib Camp class CliCamp.
Definition clicamp.cpp:42