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

Class argument_list encapsulates a list of macro arguments, i.e. the arguments to a macro reference. More...

#include <argument_list.h>

Inheritance diagram for argument_list:
innards::parameter_list_base

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 nth expand-flag to indicate whether the nth argument, if any, is eligible for macro expansion. More...
 
bool is_expandable (size_t n) const
 Say whether the nth argument, if any, is eligible for macro expansion. More...
 
- Public Member Functions inherited from innards::parameter_list_base
 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)
 

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

- Static Public Member Functions inherited from innards::parameter_list_base
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 inherited from innards::parameter_list_base
enum  defect { none, empty_param, unclosed, non_param }
 Enumeration of possible defects in a parameter_list_base More...
 
- Protected Attributes inherited from innards::parameter_list_base
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

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.

Constructor & Destructor Documentation

argument_list::argument_list ( size_t  n = 0)
inlineexplicit

Construct for n arguments.

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

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

Explicitly construct from 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 return is positioned at the first offset not consumed.

Definition at line 77 of file argument_list.h.

Member Function Documentation

bool argument_list::append ( std::string const &  arg)
private

Append an argument to the argument list.

Parameters
argThe putative argument to be appended.
Returns
True if arg has a non-0-length, else false, in which case the argument_list is unmodified.
bool argument_list::is_expandable ( size_t  n) const
inline

Say whether the nth argument, if any, is eligible for macro expansion.

Parameters
nIndex of the argument to be queried
Returns
True iff the nth member of the argument_list exists and is eligible for expansion.

Definition at line 127 of file argument_list.h.

static bool argument_list::is_valid_char ( char  ch)
inlinestaticprivate

Say whether a character can validly appear in a member of an argument list.

Parameters
chThe character to be tested.
Returns
True iff ch can validly appear in a member of an argument list.

Definition at line 145 of file argument_list.h.

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

Read the argument_list from 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 return is positioned at the first offset not consumed.

Definition at line 45 of file argument_list.cpp.

bool argument_list::set_expandable ( size_t  n,
bool  expandable = false 
)
inline

Set the nth expand-flag to indicate whether the nth argument, if any, is eligible for macro expansion.

Parameters
nIndex of the argument to be flagged
expandableA boolean denoting that that the nth argument is to be flagged as expandable or as not expandable.
Returns
True iff the nth member of the argument_list exists.

Definition at line 112 of file argument_list.h.

Member Data Documentation

std::shared_ptr<std::vector<bool> > argument_list::_expand_flags
private

The nth flag indicates whether the nth argument is eligible for macro expansion.

Definition at line 152 of file argument_list.h.


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