Click
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
ArgContext Class Reference

Argument context class. More...

#include <args.hh>

Inheritance diagram for ArgContext:
Args

Public Member Functions

 ArgContext (ErrorHandler *errh=0)
 Construct an argument context.
 
 ArgContext (const Element *context, ErrorHandler *errh=0)
 Construct an argument context.
 
const Element * context () const
 Return the element context.
 
ErrorHandler * errh () const
 Return the associated error handler.
 
String error_prefix () const
 Return a prefix string associated with the current argument.
 
void error (const char *fmt,...) const
 Report a parse error for the current argument.
 
void warning (const char *fmt,...) const
 Report a parse warning for the current argument.
 
void message (const char *fmt,...) const
 Report a message for the current argument.
 
void xmessage (const String &anno, const String &str) const
 
void xmessage (const String &anno, const char *fmt, va_list val) const
 

Protected Attributes

const Element * _context
 
ErrorHandler * _errh
 
const char * _arg_keyword
 
bool _read_status
 

Detailed Description

Argument context class.

The ArgContext class encapsulates state useful for parsing arguments: an element context and an ErrorHandler for reporting parse errors.

Args is derived from ArgContext. Some parser functions take an ArgContext reference rather than an Args reference. This clarifies that the parser function doesn't modify Args internals. Also, ArgContext objects are smaller and quicker to construct than Args objects.

Constructor & Destructor Documentation

◆ ArgContext() [1/2]

ArgContext::ArgContext ( ErrorHandler *  errh = 0)
inline

Construct an argument context.

Parameters
errhoptional error handler

◆ ArgContext() [2/2]

ArgContext::ArgContext ( const Element *  context,
ErrorHandler *  errh = 0 
)
inline

Construct an argument context.

Parameters
contextoptional element context
errhoptional error handler

Member Function Documentation

◆ context()

const Element * ArgContext::context ( ) const
inline

Return the element context.

◆ errh()

ErrorHandler * ArgContext::errh ( ) const
inline

Return the associated error handler.

◆ error_prefix()

String ArgContext::error_prefix ( ) const

Return a prefix string associated with the current argument.

If the current argument is keyword FOO, returns "FOO: ".

◆ error()

void ArgContext::error ( const char *  fmt,
  ... 
) const

Report a parse error for the current argument.

◆ warning()

void ArgContext::warning ( const char *  fmt,
  ... 
) const

Report a parse warning for the current argument.

◆ message()

void ArgContext::message ( const char *  fmt,
  ... 
) const

Report a message for the current argument.


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