coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
directive< Type > Struct Template Reference

Encapsulates a directive of a given type. More...

#include <directive.h>

Inheritance diagram for directive< Type >:
directive_base no_copy

Public Member Functions

virtual ~directive ()=default
 Destructor.
 
 directive (std::string const &arg)
 Explicitly construct a directive from a directive body. More...
 
std::string const & argument () const
 Get the body of the directive.
 
virtual void report ()
 Report the directive.
 
bool reported () const
 Say whether the directive has been reported.
 
void set_reported (bool reported=true)
 Set the status of the directive as reported or unreported.
 

Static Public Attributes

static directive_type const _type_ = Type
 The directive_type of this class.
 

Protected Types

using directives_table = std::map< std::string, bool >
 Type of global lookup table for directives of this type. More...
 
using table_entry = directives_table::value_type
 Type of entry in directives_table.
 

Static Protected Member Functions

static line_type eval (chewer< parse_buffer > &chew)
 Evaluate a directive of this type. More...
 
static directives_table::iterator insert (std::string const &arg)
 Insert a directive into the global lookup table. More...
 
- Static Protected Member Functions inherited from directive_base
static void report (std::string const &keyword, std::string const &arg)
 Report a directive. More...
 
static void report (bool seen, std::string const &keyword, std::string const &arg)
 Report a directive. More...
 
static line_type eval (directive_type type, chewer< parse_buffer > &chew)
 Evaluate a directive. More...
 
static line_type eval_ifdef_or_ifndef (directive_type type, chewer< parse_buffer > &chew)
 Evaluate an #ifdef or #ifndef directive. More...
 

Protected Attributes

directives_table::iterator _loc
 An iterator locating this directive in the global lookup table.
 

Static Protected Attributes

static std::string const _keyword_
 The keyword for directives of the type.
 
static directives_table _directives_tab_
 The global lookup table for directives of this type.
 

Friends

struct directive_base
 

Additional Inherited Members

- Static Public Member Functions inherited from directive_base
static line_type eval (std::string keyword, chewer< parse_buffer > &chew)
 Evaluate a directive. More...
 
static void erase_all ()
 Forget all directives table used by the operative command.
 

Detailed Description

template<directive_type Type>
struct directive< Type >

Encapsulates a directive of a given type.

template struct directive<Type> encapsulates a directive of a given type and provides a global lookup container for tracking occurrences of directives of that type.

The class template supports the coan commands that report occurrences of directives. The container is keyed by the canonicalised text of directive occurrence. Storing the directive occurrences in canonicalised form enables occurrences to be compared regardless of insignificant differences of whitespace or comments.

Template Parameters
TypeThe directive_type of directives contained by this class.

Definition at line 141 of file directive.h.

Member Typedef Documentation

template<directive_type Type>
using directive< Type >::directives_table = std::map<std::string,bool>
protected

Type of global lookup table for directives of this type.

The container maps the canonicalized text of the directive to a bool indicating whether the directive has been reported.

Definition at line 196 of file directive.h.

Constructor & Destructor Documentation

template<directive_type Type>
directive< Type >::directive ( std::string const &  arg)
inlineexplicit

Explicitly construct a directive from a directive body.

Parameters
argThe directive body.

Definition at line 154 of file directive.h.

Member Function Documentation

template<directive_type Type>
static line_type directive< Type >::eval ( chewer< parse_buffer > &  chew)
staticprotected

Evaluate a directive of this type.

Parameters
chewOn entry, a chewer<parse_buffer> positioned to the offset in the associated parse_buffer from which to scan. On return chew is positioned to the first offset not consumed.
Returns
A line_type determined by evaluation denoting the action to be taken on this line.
template<directive_type Type>
static directives_table::iterator directive< Type >::insert ( std::string const &  arg)
inlinestaticprotected

Insert a directive into the global lookup table.

Parameters
argThe body of the directive.
Returns
An interator to the inserted entry.

Definition at line 205 of file directive.h.


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