Doxygen_Assn5  1
91.204 Assignment No. 5
Public Member Functions | List of all members
Element Class Reference

#include <Element.h>

Public Member Functions

 Element ()
 
 Element (string strElementName, int nLineNo)
 
 Element (string strElementName, int nLineNo, string strContent)
 
 Element (const Element &orig)
 
virtual ~Element ()
 
int getNLineNo () const
 
void setNLineNo (int nLineNo)
 
string getStrTagName () const
 
void setStrTagName (string strTagName)
 
string getStrContent () const
 
void setStrContent (string strContent)
 
vector< Element * > getVecChildren () const
 
void addChild (Element *elemChild)
 
string toString ()
 
void addAttribute (string key, string value)
 
map< string, string > getMapAttributes ()
 
void setElemParent (Element *elemParent)
 
ElementgetElemParent () const
 

Detailed Description

This class represents an element in the XML file. It has been expanded from the version used in Assignment No. 1 to include elements need for Assignment No. 2.

Author
Jesse M. Heines, heines@cs.uml.edu
Version
2.01, 2012-02-13

Definition at line 26 of file Element.h.

Constructor & Destructor Documentation

Element::Element ( )

Default constructor, which initializes data members to placeholder values.

Definition at line 32 of file Element.cpp.

Element::Element ( string  strElementName,
int  nLineNo 
)

Two-parameter constructor.

Parameters
strElementNamename of element extracted from an element opening tag
nLineNoline number at which the element opening tag was found

Definition at line 46 of file Element.cpp.

Element::Element ( string  strElementName,
int  nLineNo,
string  strContent 
)

Three-parameter constructor.

Parameters
strElementNamename of element extracted from an element opening tag
nLineNoline number at which the element opening tag was found
strContenttextual content contained in the element

Definition at line 60 of file Element.cpp.

Element::Element ( const Element orig)

NetBeans-supplied copy constructor.

NetBeans-supplied copy constructor.

Parameters
origthe original object to copy.

Definition at line 20 of file Element.cpp.

Element::~Element ( )
virtual

NetBeans-supplied destructor.

Definition at line 26 of file Element.cpp.

Member Function Documentation

void Element::addAttribute ( string  key,
string  value 
)

Add an attribute to the element.

Parameters
keythe attribute's key string (to the left of the = sign)
valuethe attribute's value string (to the right of the = sign)

Definition at line 160 of file Element.cpp.

void Element::addChild ( Element elemChild)

Add a child to the vector of children.

Parameters
elemChildthe child to add

Definition at line 151 of file Element.cpp.

Element * Element::getElemParent ( ) const

Get Element Parent.

Definition at line 176 of file Element.cpp.

map< string, string > Element::getMapAttributes ( )

Get the map containing the attributes for this element.

Returns
the map of attributes for this element

Definition at line 168 of file Element.cpp.

int Element::getNLineNo ( ) const

Get the line number at which the current element was found.

Returns
line number at which the current element was found

Definition at line 97 of file Element.cpp.

string Element::getStrContent ( ) const

Get the textual content contained in the element.

Returns
textual content contained in the element

Definition at line 127 of file Element.cpp.

string Element::getStrTagName ( ) const

Get the tag name of the element found.

Returns
tag name of the element found

Definition at line 112 of file Element.cpp.

vector< Element * > Element::getVecChildren ( ) const

Get the vector of children of the current element.

Returns
the vector of children of this element

Definition at line 143 of file Element.cpp.

void Element::setElemParent ( Element elemParent)

Set Element Parent.

Definition at line 172 of file Element.cpp.

void Element::setNLineNo ( int  nLineNo)

Set the line number at which the current element was found.

Definition at line 104 of file Element.cpp.

void Element::setStrContent ( string  strContent)

Set the textual content contained in the element.

Parameters
strContentthe content to set, read from the XML file

Definition at line 135 of file Element.cpp.

void Element::setStrTagName ( string  strTagName)

Set the tag name of the element found.

Definition at line 119 of file Element.cpp.

string Element::toString ( )

Represent the object's information as a string in a reasonable format.

Returns
a string representing the object

Definition at line 72 of file Element.cpp.


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