kformula/flake

ElementFactory Class Reference

An implementation of the factory pattern to create element instances. More...

#include <ElementFactory.h>

List of all members.

Public Member Functions

 ElementFactory ()

Static Public Member Functions

static BasicElementcreateElement (const QString &tagName, BasicElement *parent)
static QString elementName (ElementType type)

Detailed Description

An implementation of the factory pattern to create element instances.

The creation of new BasicElement derived classes is an often done task. While loading ElementFactory provides a very simple way to achieve an element by passing its MathML name. Just use the static createElement() method. While saving the elementName() method is used to map the ElementType's to the according MathML names.

Author:
Martin Pfeiffer

Definition at line 77 of file ElementFactory.h.


Constructor & Destructor Documentation

ElementFactory::ElementFactory (  ) 

The default constructor.


Member Function Documentation

BasicElement * ElementFactory::createElement ( const QString tagName,
BasicElement parent 
) [static]

Obtain new instances of elements by passing the MathML tag name.

Parameters:
tagName The MathML tag name of the new element
parent The parent element of the newly created element
Returns:
A pointer to the new BasicElement derived element

Definition at line 52 of file ElementFactory.cpp.

QString ElementFactory::elementName ( ElementType  type  )  [static]

Obtain the MathML name of a ElementType.

Parameters:
type The given ElementType to get the MathML name from
Returns:
The MathML name as QString

Definition at line 115 of file ElementFactory.cpp.


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