coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
innards::parameter_list_base Struct Reference

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>

Inheritance diagram for innards::parameter_list_base:
argument_list formal_parameter_list

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_baseoperator= (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?
 

Detailed Description

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.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

parameter_list_base::parameter_list_base ( size_t  n = 0)
explicit

Constructor for n parameters.

Parameters
nThe 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.

template<class CharSeq >
innards::parameter_list_base::parameter_list_base ( chewer< CharSeq > &  chew)
inlineexplicit

Explicitly construct a given a chewer<CharSeq>.

Template Parameters
CharSeqA character-sequence type.
Parameters
chewOn 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.

Member Function Documentation

std::string const& innards::parameter_list_base::at ( size_t  n) const
inline

Get a range-checked [const] reference to the nth parameter.

Parameters
nIndex of the requested parameter.
Returns
A [const] reference to the nth paremeter.
Exceptions
<tt>std::out_of_range</tt>on out-of-range error

Definition at line 185 of file parameter_list_base.h.

std::vector<std::string>::iterator innards::parameter_list_base::begin ( )
inline

Get a [const] iterator to the start of the parameter list.

Returns
An iterator to the start of the parameter list, or std::vector<string>::iterator() if null() is true

Definition at line 150 of file parameter_list_base.h.

std::vector<std::string>::iterator innards::parameter_list_base::end ( )
inline

Get a [const] iterator to the end of the parameter list.

Returns
An iterator to the end of the parameter list, or std::vector<string>::iterator() if null() is true

Definition at line 167 of file parameter_list_base.h.

template<typename BiIter >
static std::string innards::parameter_list_base::make ( BiIter  first,
BiIter  last 
)
inlinestatic

Make a parameter list from a range of objects that are convertible to std::string.

Template Parameters
BiIterA bidorectional iterator.
Parameters
firstThe start of the range of objects.
lastThe end of the range of objects.
Returns
A string comprising the comma-punctuated list of [first,last), enclosed in parentheses.

Definition at line 244 of file parameter_list_base.h.

std::string const& innards::parameter_list_base::operator[] ( size_t  n) const
inline

Get an un-range-checked [const] reference to the nth parameter.

Parameters
nIndex of the requested parameter.
Returns
A [const] reference to the parameter at index n.
Exceptions
<tt>std::out_of_range</tt>on out-of-range error

Definition at line 208 of file parameter_list_base.h.

template<class CharSeq >
void innards::parameter_list_base::read ( chewer< CharSeq > &  chew)

Read the parameter_list_base from chewer<CharSeq>

Template Parameters
CharSeqA character-sequence type.
Parameters
chewOn 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

size_t innards::parameter_list_base::size ( ) const
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.


The documentation for this struct was generated from the following files: