struct parameter_substitution::format
encapsulates a parameter substitution format.
More...
#include <parameter_substitution.h>
|
| format (symbol &sym) |
| Construct a parameter substitution format for a given symbol.
|
|
std::string const & | str () const |
| Get a reference to the format string.
|
|
std::string | legible () const |
| Get a string legibly representing the format.
|
|
|
static std::string | legible (std::string const &pb) |
| Get a string legibly representing a string with embedded specifiers.
|
|
|
std::string | _fmt |
| The format string.
|
|
std::vector< size_t > | _stringify_offs |
| Vector of offsets of # -operators.
|
|
std::vector< size_t > | _token_paste_offs |
| Vector of offset of ## -operators.
|
|
struct parameter_substitution::format
encapsulates a parameter substitution format.
Such a format is a string with embedded specifiers that encodes the substitution of arguments for parameters into the format.
Definition at line 257 of file parameter_substitution.h.
ptrdiff_t parameter_substitution::format::adjust_for_stringify_op |
( |
size_t |
pos, |
|
|
size_t |
nparams |
|
) |
| |
|
private |
Adjust the format for a '#'-operator.
If nparams
> 0 and the operand is a format specifier then the operator and operand are replaced with the corresponding <substitute_quoted_arg_specifier>
- Parameters
-
pos | The offset to the '#'-operator. |
nparams | The number of parameters of the symbol requiring the format |
- Returns
- The signed difference in the length of the format that results from the adjustment.
- Exceptions
-
error_stringify_non_param | if nparams1 > 0 and an operand of # is not a parameter. |
ptrdiff_t parameter_substitution::format::adjust_for_token_paste_op |
( |
size_t |
pos | ) |
|
|
private |
Adjust the format for a '##'-operator.
If the either operand is a format specifier then it is replaced with the corresponding <substitute_arg_specifier>
The operator and flanking whitespace are deleted.
- Parameters
-
pos | The offset to the '##'-operator. |
- Returns
- The signed difference in the length of the format that results from the adjustment.
- Exceptions
-
error_misplaced_token_paste | if the operator has no left operand or no right operand. |
error_bad_token_paste | if pasting the operands will not form a token |
void parameter_substitution::format::build_format |
( |
symbol & |
sym | ) |
|
|
private |
Build a format with appropriate specifiers inserted at all parameter positions.
- Parameters
-
sym | The symbol for which the format is built. |
void parameter_substitution::format::do_stringify_adjustments |
( |
size_t |
nparams | ) |
|
|
private |
After building the first-cut format, make any necessary adjustments for the presence of '#'-operators.
Occurrences of #<whitespace><subsititute_expanded_arg_specifier>
are replaced by the corresponding <subsititute_quoted_arg_specifier>
- Parameters
-
nparams | The number of parameters of the symbol requiring the format. |
- Exceptions
-
error_stringify_non_param | if nparams1 > 0 and an operand of # is not a parameter. |
void parameter_substitution::format::do_token_paste_adjustments |
( |
| ) |
|
|
private |
After building the first-cut format, make any necessary adjustments for the presence of '##'-operators.
Consecutive occurrences of '##' are collapsed to one.
If an operand is <subsititute_expanded_arg_specifier>
that operand is replaced with the corresponding <substitute_arg_specifier>
Remaining occurrences of '##' and flanking whitespace are deleted.
- Exceptions
-
error_misplaced_token_paste | if an '##'-operator has no left operand or no right operand. |
error_bad_token_paste | if pasting the operands of ## will not form a token |
The documentation for this struct was generated from the following file: