This is the reference documentation of module ALib Camp of the ALib C++ Framework.
Besides the few entities found and documented here (namely in namespace alib::camp), this module "injects" several overloaded versions of the function CampVariable into namespace alib::variables.
Type Index: | |
| class | Basecamp |
| class | Camp |
| class | DevtimeResourceCompiler |
| struct | ResourceFileError |
| Represents an error that occurred with the function LoadResourceFile. More... | |
| struct | ResourceListEntry |
Type Definition Index: | |
| using | RCErrorList = StdVectorMA<ResourceFileError> |
| A list of errors that occurred with LoadResourceFile. | |
| using | ResourceList = StdVectorMA<ResourceListEntry> |
A collection of resource entries, typically loaded from an .alibrc file. | |
Enumeration Index: | |
| enum class | ResourceFileErrors { OK , RCFileNotFoundOrAccessible , ErrIllegalResourceName , ErrNameTooLong , ErrLineEndWhileInQuotes , DuplicateResourceName , CPPFileNotFoundOrAccessible , CPPFileMissingStartMarker , CPPFileMissingEndMarker , CPPFileNotWritable } |
| Error values that the function LoadResourceFile may return. More... | |
| enum class | Variables { LOCALE = 1 , WAIT_FOR_KEY_PRESS = 2 , HAS_CONSOLE_WINDOW = 3 } |
Function Index: | |
| void | ListErrors (RCErrorList &errors, Paragraphs &output, const PathString &fileName) |
| void | LoadResourceFile (Path &rcFileName, ResourceList &destination, RCErrorList &errors) |
| void | PatchCPPFile (const Path &cppFilePath, const ResourceList &resources, RCErrorList &errors, bool dryRun=false) |
A list of errors that occurred with LoadResourceFile.
Definition at line 64 of file resourcecompiler.hpp.
A collection of resource entries, typically loaded from an .alibrc file.
Definition at line 61 of file resourcecompiler.hpp.
|
strong |
Error values that the function LoadResourceFile may return.
Definition at line 13 of file resourcecompiler.hpp.
|
strong |
Configuration variables of ALib.
| Enumerator | |
|---|---|
| LOCALE | See ALIB/LOCALE. |
| WAIT_FOR_KEY_PRESS | |
| HAS_CONSOLE_WINDOW | |
Definition at line 32 of file basecamp.hpp.
| void alib::camp::ListErrors | ( | RCErrorList & | errors, |
| Paragraphs & | output, | ||
| const PathString & | fileName ) |
Writes a given list of errors (usually generated with function LoadResourceFile) to the given output in a human-readable format.
| errors | The error list. |
| output | The output formatter. |
| fileName | The name of the resource file. |
| void alib::camp::LoadResourceFile | ( | Path & | rcFileName, |
| ResourceList & | destination, | ||
| RCErrorList & | errors ) |
Reads an external resource file (.alibrc) and appends parsed resources to destination.
Each resource entry starts at a non-empty, non-comment line:
'"'.'\n', '\t', '\\', '\"'</c>,
...).
- Preserves spaces and tabs inside the quotes.
2. <strong>Plain</strong>: anything else on the same line.
- Everything until end-of-line becomes the value (trailing whitespace is trimmed).
- Backslash escapes are processed.
3. <strong>Block scalars</strong>: start with <c>'|'</c> or <c>'>'</c> (must appear as the first
non-whitespace of the value)
- <tt>Key |</tt> <c>Literal block: preserves newlines.
- <tt>Key \></tt> <c>Folded block</c>: converts line breaks to single spaces, except that empty lines
create paragraph breaks (<c>'\n'</c>).
- Block content starts on the next line and is terminated by a non-empty line whose indentation
is <strong>not greater</strong> than the indentation of the key line. (Empty lines are always part of the block.)
- Backslash escapes are processed in the block content.
- Trailing empty lines are ignored; i.e., trailing <c>'\\n'</c> characters are stripped from
the parsed value. To enforce trailing newlines, use explicit escape sequences at the end
of the last content line.
4. <strong>Compact scalars</strong>: start with <c>'~'</c>
- Intended for machine-parsed token streams (e.g. <tt>a,1,b,2,...</tt>) that should be
human-formattable in the resource file.
- Outside quoted portions, <b>all whitespace is ignored</b> (including newlines in the
block form).
- Quoted portions are allowed and preserve whitespace:
<c>DateC ~1,now,"1.1.2026",1,,2,file,1,filename,"my file"Key ~ : compact until end-of-line.Key ~| : compact block (indented), lines may be wrapped/aligned freely.| rcFileName | The path to the .alibrc input file. |
| destination | The destination vector to receive parsed resource entries. |
| errors | A list receiving read errors. |
| void alib::camp::PatchCPPFile | ( | const Path & | cppFilePath, |
| const ResourceList & | resources, | ||
| RCErrorList & | errors, | ||
| bool | dryRun = false ) |
Patches a C++ source file with generated resource loading code.
This function updates a designated section in a C++ source file by replacing the content between two marker comments with generated code that loads resources via ResourcePool::BootstrapBulk.
The file given with cppFilePath must contain two commented marker lines:
ALIB-RESOURCE-COMPILER-REPLACEMENT-STARTALIB-RESOURCE-COMPILER-REPLACEMENT-ENDAll lines between these markers are replaced with generated key/value pairs formatted as C++ string literals suitable for ResourcePool::BootstrapBulk.
The generated code includes:
For an example of the generated output, see App/sample.cpp.
| cppFilePath | The path to the C++ source file to patch. |
| resources | The list of resources to generate code for. |
| errors | A list receiving errors that might occur. |
| dryRun | If given as true, the file is not written. |