1 #ifndef PARAMETER_SUBSTUTION_H
2 #define PARAMETER_SUBSTUTION_H
46 struct parameter_list;
57 namespace parameter_substitution {
102 _bytes[0] = char(demarcator::stx);
117 return !(*
this == other);
122 for (
size_t i = 0; i <
sizeof(
_bytes); ++i) {
154 explicit operator bool()
const {
167 if (chew && *chew ==
char(demarcator::stx) && !chew.
overshoot(3)) {
172 unsigned short param_i = (chew[1] << 8) | chew[2];
193 std::string
const & str,
197 if (str[off] ==
char(demarcator::stx) && off + 3 < str.size()) {
198 char h = str[off + 3];
207 return std::string::npos;
223 std::string
const & str,
227 ptrdiff_t start = off - 3;
228 if (start >= 0 && str[start] ==
char(demarcator::stx)) {
238 return std::string::npos;
263 std::string
const &
str()
const {
273 static std::string
legible(std::string
const & pb);
Substitute the argument literally enclosed in double quotes.
std::string legible() const
Get a string legibly representing the specifier.
handling
Enumerated constants denoting the manner in which an argument is to be substituted for a macro parame...
char _bytes[serialized_size]
The specifier data.
demarcator
Non-printable fields in a substitution format.
bool operator!=(specifier const &other) const
Inequality.
static size_t get_at(std::string const &str, size_t off, size_t &i_off, size_t &h_off)
Attempt to detect a specifier from a string position.
bool overshoot(size_t off=0) const
Say whether the scanning position is past the end of the associated sequence_type ...
Substitute the full macro expansion of the argument.
bool null() const
Say whether the specifier is null.
void append_to(std::string &s)
Append the specifier to a string.
handling get_handling() const
Get the handling of the specified parameter.
specifier(unsigned short param_i, handling h)
Construct a specifier for the parameter indexed param_i to be handled in manner h ...
struct paramater_substitution::specifier encapsulates a parameter substitution specifier.
unsigned short get_param_index() const
Get the index of the specified parameter.
`template struct chewer<CharSeq> is a cursor-like type that is associated with a character-sequence t...
static size_t get_ending_at(std::string const &str, size_t off, size_t &i_off, size_t &h_off)
Attempt to detect a specifier ending at a string position.
void set_handling(handling h)
Set the handling of the specified parameter.
struct symbol encapsulates a preprocessor symbol's state
static specifier read(chewer< std::string > &chew)
Attempt to read a specifier from a chewer<std::string>.
bool operator==(specifier const &other) const
Equality.
specifier()
The default constructor yields the null specifier.
Substitute the argument literally.
void set_param_index(unsigned short i)
Set the index of the specified parameter.
static const size_t serialized_size
Serialized size of a substitution specifier.