bypass-core-1.0
|
An object that describes some portion of a markdown document. More...
#include <src/element.h>
Public Types | |
typedef std::map< std::string, std::string > | AttributeMap |
The type of a collection of attributes; essentially a collection of name-value pairs. | |
Public Member Functions | |
Element () | |
Creates a new Element . | |
~Element () | |
Destroys the Element . | |
void | setText (const std::string &text) |
Sets the text for this Element . | |
const std::string & | getText () |
Returns the text of this element . | |
void | addAttribute (const std::string &name, const std::string &value) |
Adds an attribute to this Element . | |
std::string | getAttribute (const std::string &name) |
Gets an attribute by name. | |
AttributeMap::iterator | attrBegin () |
Gets an iterator pointing to the first attribute. | |
AttributeMap::iterator | attrEnd () |
Gets an iterator pointing to the last attributr. | |
size_t | attrSize () const |
gets the number of attributes. | |
void | append (const Element &blockElement) |
Appends a block element to this element. | |
Element | getChild (size_t i) |
Gets a child Element of this Element . | |
Element | operator[] (size_t i) |
Gets a child Element of this Element . | |
void | setType (Type type) |
Sets the type of this Dlement . | |
Type | getType () |
Gets the type of this element. | |
bool | isBlockElement () |
Indicates whether or not this element is a block element. | |
bool | isSpanElement () |
Indicates whether or not this element is a span element. | |
size_t | size () |
The number of children this particular Element has. | |
Data Fields | |
std::string | text |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Element &element) |
An object that describes some portion of a markdown document.
The portion of the markdown that it represents depends on what the given text is surrounded with. For example, *this*
would produce an emphasized word that would in turn be rendered in italics.
typedef std::map<std::string, std::string> Bypass::Element::AttributeMap |
The type of a collection of attributes; essentially a collection of name-value pairs.
Bypass::Element::Element | ( | ) |
Creates a new Element
.
Bypass::Element::~Element | ( | ) |
Destroys the Element
.
void Bypass::Element::addAttribute | ( | const std::string & | name, |
const std::string & | value | ||
) |
Adds an attribute to this Element
.
The term "attribute" was intentionally borrowed from the world of HTML, even though the resultant Document
will not be rendered as HTML. This was done so that a unified language could be succinctly defined and easily understood.
name | The name or LHS of the attribute. |
value | The value of RHS of the attribute. |
void Bypass::Element::append | ( | const Element & | blockElement | ) |
Appends a block element to this element.
blockElement | The block element to nest within this element. |
AttributeMap::iterator Bypass::Element::attrBegin | ( | ) |
Gets an iterator pointing to the first attribute.
AttributeMap::iterator Bypass::Element::attrEnd | ( | ) |
Gets an iterator pointing to the last attributr.
size_t Bypass::Element::attrSize | ( | ) | const |
gets the number of attributes.
std::string Bypass::Element::getAttribute | ( | const std::string & | name | ) |
Gets an attribute by name.
name | The name of the attribute to return. |
Element Bypass::Element::getChild | ( | size_t | i | ) |
const std::string& Bypass::Element::getText | ( | ) |
Returns the text of this element
.
Type Bypass::Element::getType | ( | ) |
Gets the type of this element.
Type
of this element. bool Bypass::Element::isBlockElement | ( | ) |
Indicates whether or not this element is a block element.
bool Bypass::Element::isSpanElement | ( | ) |
Indicates whether or not this element is a span element.
Element Bypass::Element::operator[] | ( | size_t | i | ) |
void Bypass::Element::setText | ( | const std::string & | text | ) |
void Bypass::Element::setType | ( | Type | type | ) |
Sets the type of this Dlement
.
type | The type of this Element . |
size_t Bypass::Element::size | ( | ) |
The number of children this particular Element
has.
|
friend |
std::string Bypass::Element::text |