coan
6.0.1
A C/C++ Configuration Analyzer
|
template struct innards::parameter_list_base<Tag>
generically defines a common interface of types representing a formal parameter list or an argment list.
More...
#include <parameter_list_base.h>
Public Member Functions | |
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) |
Static Public Member Functions | |
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... | |
Protected Types | |
enum | defect { none, empty_param, unclosed, non_param } |
Enumeration of possible defects in a parameter_list_base More... | |
Protected Attributes | |
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? | |
template struct innards::parameter_list_base<Tag>
generically defines a common interface of types representing a formal parameter list or an argment list.
Definition at line 56 of file parameter_list_base.h.
|
protected |
Enumeration of possible defects in a parameter_list_base
Enumerator | |
---|---|
none |
No defects. |
empty_param |
An empty parameter. |
unclosed |
No closing ')'. |
non_param |
Non-identifier where parameter expected. |
Definition at line 261 of file parameter_list_base.h.
|
explicit |
Constructor for n
parameters.
n | The number of parameters. If `n` > 0, the list of placeholder parameters `$1,...,$n` is constructed. |
Definition at line 45 of file parameter_list_base.cpp.
|
inlineexplicit |
Explicitly construct a given 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 returnchew is positioned to the first offset not consumed. |
Definition at line 75 of file parameter_list_base.h.
|
inline |
Get a range-checked [const] reference to the nth parameter.
n | Index of the requested parameter. |
<tt>std::out_of_range</tt> | on out-of-range error |
Definition at line 185 of file parameter_list_base.h.
|
inline |
Get a [const] iterator to the start of the parameter list.
std::vector<string>::iterator()
if null()
is true Definition at line 150 of file parameter_list_base.h.
|
inline |
Get a [const] iterator to the end of the parameter list.
std::vector<string>::iterator()
if null()
is true Definition at line 167 of file parameter_list_base.h.
|
inlinestatic |
Make a parameter list from a range of objects that are convertible to std::string
.
BiIter | A bidorectional iterator. |
first | The start of the range of objects. |
last | The end of the range of objects. |
Definition at line 244 of file parameter_list_base.h.
|
inline |
Get an un-range-checked [const] reference to the nth parameter.
n | Index of the requested parameter. |
n
. <tt>std::out_of_range</tt> | on out-of-range error |
Definition at line 208 of file parameter_list_base.h.
void innards::parameter_list_base::read | ( | chewer< CharSeq > & | chew | ) |
Read the parameter_list_base
from 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 returnchew is positioned to the first offset not consumed. |
The parameter_list_base
is emptied and replaced by parsing the text from chew
|
inline |
Get the number of parameters in the parameter_list_base
The non-null parameter list "()" has size 0, as does the null parameter list ""
Definition at line 126 of file parameter_list_base.h.