Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
AbstractAttribute Class Reference

#include <elm/xom/dtd.h>

+ Inheritance diagram for AbstractAttribute:

Public Member Functions

 AbstractAttribute (Element &element, xom::String name, t::uint32 flags=0)
 
virtual ~AbstractAttribute ()
 
xom::String name () const
 
Elementelement () const
 
bool isRequired () const
 
bool isStrict () const
 
bool isForward () const
 
bool isSet () const
 
bool operator== (const AbstractAttribute &a) const
 
bool operator!= (const AbstractAttribute &a) const
 

Static Public Attributes

static const t::uint32 REQUIRED = 0x01
 
static const t::uint32 STRICT = 0x02
 
static const t::uint32 FORWARD = 0x04
 

Protected Member Functions

bool parse (Parser &parser)
 
virtual bool process (Parser &parser, xom::String value)
 
virtual void reset ()
 
virtual void postprocess (Parser &parser)
 

Detailed Description

This class is the base class of DTD attributes. It provides basic facilities to describe an XML attribute: name and flags.

The following flags are supported:

Constructor & Destructor Documentation

◆ AbstractAttribute()

AbstractAttribute ( Element element,
xom::String  name,
t::uint32  flags = 0 
)

Attribute constructor.

Parameters
elementParent element.
nameAttribute name.
flagsOR'ed combination of REQUIRED and STRICT.

References AbstractAttribute::element().

◆ ~AbstractAttribute()

~AbstractAttribute ( )
virtual

Member Function Documentation

◆ element()

Element& element ( ) const
inline

◆ isForward()

bool isForward ( ) const
inline

References elm::dtd::FORWARD.

◆ isRequired()

bool isRequired ( ) const
inline

Test if the attribute is required.

Returns
True if the attribute is required, false else.

References elm::dtd::REQUIRED.

Referenced by AbstractAttribute::parse().

◆ isSet()

bool isSet ( ) const
inline

Test if the attribute has been set.

Returns
True if the attribute is set, false else.

◆ isStrict()

bool isStrict ( ) const
inline

Test if the attribute is strict.

Returns
True if the attribute is strict, false else.

References elm::dtd::STRICT.

Referenced by IDAttribute::process().

◆ name()

xom::String name ( ) const
inline

Get the name of the attribute.

Returns
Attribute name.

Referenced by IDAttribute::process().

◆ operator!=()

bool operator!= ( const AbstractAttribute a) const
inline

References elm::operator==().

◆ operator==()

bool operator== ( const AbstractAttribute a) const
inline

◆ parse()

bool parse ( Parser parser)
protected

Parse the attribute from the current element in the parser. The default implementation look for the attribute. If found, the function process() is called with the attribute value. Else adjust the return value according to the required property.

Parameters
parserCurrent parser.
Returns
True if the parsing is successful, false else.

References Parser::get(), AbstractAttribute::isRequired(), AbstractAttribute::process(), AbstractAttribute::reset(), and Option< T >::some().

◆ postprocess()

void postprocess ( Parser parser)
protectedvirtual

Function called after the call to Factory::begin() for the element containing the attribute, if it has been recorded with Parser::addPost(). It is used for attributes requiring the reference to the application current object like identifiers or forward references.

The default implementation does nothing.

Parameters
parserCurrent parser.

Reimplemented in RefAttribute< T >, and IDAttribute.

◆ process()

bool process ( Parser parser,
xom::String  value 
)
protectedvirtual

This function is called by parse() if a value is found for the attribute. The role of this function is to process the found value. The default implementation does nothing but it can overridden.

Reimplemented in RefAttribute< T >, IDAttribute, Attribute< xom::String >, and Attribute< T >.

Referenced by AbstractAttribute::parse().

◆ reset()

void reset ( )
protectedvirtual

Function called to reset the value stored in the attribute. The default implementation does nothing but it can be overridden.

Reimplemented in RefAttribute< T >, IDAttribute, Attribute< xom::String >, and Attribute< T >.

Referenced by AbstractAttribute::parse(), Attribute< T >::reset(), IDAttribute::reset(), and RefAttribute< T >::reset().

Member Data Documentation

◆ FORWARD

const t::uint32 FORWARD = 0x04
static

◆ REQUIRED

REQUIRED = 0x01
static

Attribute flag meaning that the attribute is required to parse the element containing it.

◆ STRICT

STRICT = 0x02
static

Attribute flag meaning that an error in the attribute parsing stops the parsing of the whole document and raises an error.


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