coan
6.0.1
A C/C++ Configuration Analyzer
|
Class argument_list
encapsulates a list of macro arguments, i.e. the arguments to a macro reference.
More...
#include <argument_list.h>
Public Types | |
using | base = innards::parameter_list_base |
Base class. | |
Public Member Functions | |
argument_list (parameter_list_base const &parms) | |
Explicitly construct from an innards::parameter_list_base | |
argument_list (size_t n=0) | |
Construct for n arguments. More... | |
template<class CharSeq > | |
argument_list (chewer< CharSeq > &chew) | |
Explicitly construct from a chewer<CharSeq> More... | |
bool | operator== (argument_list const &other) const |
Equality. | |
bool | operator!= (argument_list const &other) const |
Inequality. | |
template<class CharSeq > | |
void | read (chewer< CharSeq > &chew) |
Read the argument_list from a chewer<CharSeq> More... | |
bool | set_expandable (size_t n, bool expandable=false) |
Set the n th expand-flag to indicate whether the n th argument, if any, is eligible for macro expansion. More... | |
bool | is_expandable (size_t n) const |
Say whether the n th argument, if any, is eligible for macro expansion. More... | |
![]() | |
parameter_list_base (size_t n=0) | |
Constructor for n parameters. More... | |
template<class CharSeq > | |
parameter_list_base (chewer< CharSeq > &chew) | |
Explicitly construct a given a chewer<CharSeq> . More... | |
parameter_list_base (parameter_list_base const &other) | |
Copy constructor. | |
void | swap (parameter_list_base &other) |
Swap with another parameter_list_base | |
parameter_list_base & | operator= (parameter_list_base other) |
Assignment. | |
bool | operator== (parameter_list_base const &other) const |
Equality. | |
bool | operator!= (parameter_list_base const &other) const |
Inequality. | |
bool | well_formed () const |
Say whether the parameter_list_base is well-formed. | |
bool | variadic () const |
Say whether the parameter_list_base is variadic. | |
size_t | size () const |
Get the number of parameters in the parameter_list_base More... | |
bool | null () const |
Say whether the parameter_list_base is null, i.e. is not even "()". | |
operator bool () const | |
Cast to boolean = !null() | |
std::string | str () const |
Cast the parameter list to its canonical string representation. | |
size_t | which (std::string const &str) const |
Get the index of the parameter that matches a string, if any, else -1. | |
template<class CharSeq > | |
void | read (chewer< CharSeq > &chew) |
Read the parameter_list_base from chewer<CharSeq> More... | |
std::vector< std::string > ::iterator | begin () |
Get a [const] iterator to the start of the parameter list. More... | |
std::vector< std::string > ::const_iterator | begin () const |
std::vector< std::string > ::iterator | end () |
Get a [const] iterator to the end of the parameter list. More... | |
std::vector< std::string > ::const_iterator | end () const |
std::string const & | at (size_t n) const |
Get a range-checked [const] reference to the nth parameter. More... | |
std::string & | at (size_t n) |
std::string const & | operator[] (size_t n) const |
Get an un-range-checked [const] reference to the nth parameter. More... | |
std::string & | operator[] (size_t n) |
Private Member Functions | |
bool | append (std::string const &arg) |
Append an argument to the argument list. More... | |
Static Private Member Functions | |
static bool | is_valid_char (char ch) |
Say whether a character can validly appear in a member of an argument list . More... | |
Private Attributes | |
std::shared_ptr< std::vector < bool > > | _expand_flags |
Additional Inherited Members | |
![]() | |
template<typename BiIter > | |
static std::string | make (BiIter first, BiIter last) |
Make a parameter list from a range of objects that are convertible to std::string . More... | |
![]() | |
enum | defect { none, empty_param, unclosed, non_param } |
Enumeration of possible defects in a parameter_list_base More... | |
![]() | |
std::shared_ptr< std::vector < std::string > > | _params |
The list of parameters. | |
defect | _defect |
Is the parameter_list_base well-formed? | |
bool | _variadic |
Is the parameter_list_base variadic? | |
Class argument_list
encapsulates a list of macro arguments, i.e. the arguments to a macro reference.
Associated with each argument is a boolean flag indicating whether that argument is eligible for macro expansion. By default this flag is false.
Definition at line 50 of file argument_list.h.
|
inlineexplicit |
Construct for n
arguments.
n | The number of arguments of the argument list |
If n
> 0, the list of placeholder arguments $1,...,$n
is constructed.
Definition at line 66 of file argument_list.h.
|
inlineexplicit |
Explicitly construct from a chewer<CharSeq>
CharSeq | A character-sequence type |
chew | On entry, a chewer<CharSeq> positioned at the offset in the associated CharSeq from which to scan. On return is positioned at the first offset not consumed. |
Definition at line 77 of file argument_list.h.
|
private |
Append an argument to the argument list.
arg | The putative argument to be appended. |
arg
has a non-0-length, else false, in which case the argument_list
is unmodified.
|
inline |
Say whether the n
th argument, if any, is eligible for macro expansion.
n | Index of the argument to be queried |
n
th member of the argument_list
exists and is eligible for expansion. Definition at line 127 of file argument_list.h.
|
inlinestaticprivate |
Say whether a character can validly appear in a member of an argument list
.
ch | The character to be tested. |
ch
can validly appear in a member of an argument list
. Definition at line 145 of file argument_list.h.
template void argument_list::read | ( | chewer< CharSeq > & | chew | ) |
Read the argument_list
from a chewer<CharSeq>
CharSeq | A character-sequence type |
chew | On entry, a chewer<CharSeq> positioned at the offset in the associated CharSeq from which to scan. On return is positioned at the first offset not consumed. |
Definition at line 45 of file argument_list.cpp.
|
inline |
Set the n
th expand-flag to indicate whether the n
th argument, if any, is eligible for macro expansion.
n | Index of the argument to be flagged |
expandable | A boolean denoting that that the n th argument is to be flagged as expandable or as not expandable. |
n
th member of the argument_list
exists. Definition at line 112 of file argument_list.h.
|
private |
The n
th flag indicates whether the nth argument is eligible for macro expansion.
Definition at line 152 of file argument_list.h.