bypass-core-1.0
Bypass::Element Class Reference

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)
 

Detailed Description

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.

Member Typedef Documentation

typedef std::map<std::string, std::string> Bypass::Element::AttributeMap

The type of a collection of attributes; essentially a collection of name-value pairs.

Constructor & Destructor Documentation

Bypass::Element::Element ( )

Creates a new Element.

Bypass::Element::~Element ( )

Destroys the Element.

Member Function Documentation

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.

Parameters
nameThe name or LHS of the attribute.
valueThe value of RHS of the attribute.
void Bypass::Element::append ( const Element blockElement)

Appends a block element to this element.

Parameters
blockElementThe 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.

Parameters
nameThe name of the attribute to return.
Returns
The value of the named attribute.
Element Bypass::Element::getChild ( size_t  i)

Gets a child Element of this Element.

Parameters
iThe index of the child to retrieve.
Returns
The child.
const std::string& Bypass::Element::getText ( )

Returns the text of this element.

Type Bypass::Element::getType ( )

Gets the type of this element.

Returns
The 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)

Gets a child Element of this Element.

Parameters
iThe index of the child to retrieve.
Returns
The child.
void Bypass::Element::setText ( const std::string &  text)

Sets the text for this Element.

Parameters
textThe actual text to set for this Element.
void Bypass::Element::setType ( Type  type)

Sets the type of this Dlement.

Parameters
typeThe type of this Element.
size_t Bypass::Element::size ( )

The number of children this particular Element has.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Element element 
)
friend

Field Documentation

std::string Bypass::Element::text

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