Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/xom/dtd.h>
Public Member Functions | |
AbstractAttribute (Element &element, xom::String name, t::uint32 flags=0) | |
virtual | ~AbstractAttribute () |
xom::String | name () const |
Element & | element () 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) |
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:
AbstractAttribute | ( | Element & | element, |
xom::String | name, | ||
t::uint32 | flags = 0 |
||
) |
Attribute constructor.
element | Parent element. |
name | Attribute name. |
flags | OR'ed combination of REQUIRED and STRICT. |
References AbstractAttribute::element().
|
virtual |
|
inline |
Referenced by AbstractAttribute::AbstractAttribute(), and IDAttribute::postprocess().
|
inline |
References elm::dtd::FORWARD.
|
inline |
Test if the attribute is required.
References elm::dtd::REQUIRED.
Referenced by AbstractAttribute::parse().
|
inline |
Test if the attribute has been set.
|
inline |
Test if the attribute is strict.
References elm::dtd::STRICT.
Referenced by IDAttribute::process().
|
inline |
|
inline |
References elm::operator==().
|
inline |
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.
parser | Current parser. |
References Parser::get(), AbstractAttribute::isRequired(), AbstractAttribute::process(), AbstractAttribute::reset(), and Option< T >::some().
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.
parser | Current parser. |
Reimplemented in RefAttribute< T >, and IDAttribute.
|
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().
|
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().
|
static |
|
static |
Attribute flag meaning that the attribute is required to parse the element containing it.
|
static |
Attribute flag meaning that an error in the attribute parsing stops the parsing of the whole document and raises an error.