QElectroTech  0.8-dev
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DiagramContext Class Reference

#include <diagramcontext.h>

Collaboration diagram for DiagramContext:
Collaboration graph

Public Types

enum  KeyOrder { None, Alphabetical, DecreasingLength }
 

Public Member Functions

void add (DiagramContext other)
 DiagramContext::add Add all value of other to this. If a key already exist, the value is replaced. If a key doesn't exist, she will be added. All other keys of this context, which are not present in other, stay unchanged. More...
 
void remove (const QString &key)
 DiagramContext::remove. More...
 
QList< QString > keys (KeyOrder=None) const
 
bool contains (const QString &) const
 
const QVariant operator[] (const QString &) const
 
bool addValue (const QString &, const QVariant &, bool show=true)
 
QVariant value (const QString &key) const
 
void clear ()
 
int count ()
 
bool keyMustShow (const QString &) const
 DiagramContext::keyMustShow. More...
 
bool operator== (const DiagramContext &) const
 
bool operator!= (const DiagramContext &) const
 
void toXml (QDomElement &, const QString &="property") const
 
void fromXml (const QDomElement &, const QString &="property")
 
void fromXml (const pugi::xml_node &dom_element, const QString &tag_name="property")
 DiagramContext::fromXml Read this context properties from the dom_element, looking for tags named tag_name. More...
 
void toSettings (QSettings &, const QString &) const
 
void fromSettings (QSettings &, const QString &)
 

Static Public Member Functions

static QString validKeyRegExp ()
 

Private Member Functions

bool keyIsAcceptable (const QString &) const
 

Static Private Member Functions

static bool stringLongerThan (const QString &, const QString &)
 

Private Attributes

QHash< QString, QVariant > m_content
 Diagram context data (key/value pairs) More...
 
QHash< QString, bool > m_content_show
 

Detailed Description

This class represents a diagram context, i.e. the data (a list of key/value pairs) of a diagram at a given time. It is notably used by titleblock templates to fetch the informations they need to do their rendering, or element for retrieve information about itself Key for element : label -> label or identification of element formula -> formula used to create the label (formula is make with variable) designation -> exhaustive comment used to explain what the element does. description -> exhaustive description used to explain what the element does. plant -> the plant assigned to the element comment -> a little comment wich can be displayed in the folio manufacturer -> the manufacturer of the element manufacturer_reference -> the manufacturer reference of the element quantity -> quantity of the element unity -> unity of the element auxiliary1 -> auxiliary 1 of element auxiliary2 -> auxiliary 2 of element machine_manufacturer_reference -> reference of the machine manufacturer supplier -> the supplier of the element function -> the function of element location -> the location assigned to the element frozenLabel -> label locked at a given time

Member Enumeration Documentation

◆ KeyOrder

Enumerator
None 
Alphabetical 
DecreasingLength 

Member Function Documentation

◆ add()

void DiagramContext::add ( DiagramContext  other)

DiagramContext::add Add all value of other to this. If a key already exist, the value is replaced. If a key doesn't exist, she will be added. All other keys of this context, which are not present in other, stay unchanged.

Parameters
other
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addValue()

bool DiagramContext::addValue ( const QString &  key,
const QVariant &  value,
bool  show = true 
)
Parameters
keykey to insert in the context - the key may only contain lowercase letters and dashes. If embedded key is set, key must be find it else value is not added.
See also
DiagramContext::keyIsAcceptable()
Parameters
valuevalue to insert in the context
showif value is used to be show on the diagram or somewhere else, we can specify if he is show(true) or not(false)
Returns
true if the insertion succeeds, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void DiagramContext::clear ( )

Clear the content of this diagram context.

Here is the caller graph for this function:

◆ contains()

bool DiagramContext::contains ( const QString &  key) const
Parameters
keystring key
Returns
true if that key is known to the diagram context, false otherwise
Here is the caller graph for this function:

◆ count()

int DiagramContext::count ( )
Returns
the number of key/value pairs stored in this object.

◆ fromSettings()

void DiagramContext::fromSettings ( QSettings &  settings,
const QString &  array_name 
)

Read this context properties from settings by running through the array named array_name.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromXml() [1/2]

void DiagramContext::fromXml ( const pugi::xml_node &  dom_element,
const QString &  tag_name = "property" 
)

DiagramContext::fromXml Read this context properties from the dom_element, looking for tags named tag_name.

Parameters
dom_element: dom element to parse
tag_name: tag name to find, by default "property"
Here is the call graph for this function:

◆ fromXml() [2/2]

void DiagramContext::fromXml ( const QDomElement &  e,
const QString &  tag_name = "property" 
)

Read this context properties from the e XML element, looking for tags named tag_name (defaults to "property").

Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyIsAcceptable()

bool DiagramContext::keyIsAcceptable ( const QString &  key) const
private
Parameters
keya key string
Returns
true if that key is acceptable, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyMustShow()

bool DiagramContext::keyMustShow ( const QString &  key) const

DiagramContext::keyMustShow.

Returns
the value pairs with key, if key no found, return false
Here is the caller graph for this function:

◆ keys()

QList< QString > DiagramContext::keys ( DiagramContext::KeyOrder  order = None) const
Returns
a list containing all the keys in the context object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool DiagramContext::operator!= ( const DiagramContext dc) const

◆ operator==()

bool DiagramContext::operator== ( const DiagramContext dc) const

◆ operator[]()

const QVariant DiagramContext::operator[] ( const QString &  key) const
Parameters
key

◆ remove()

void DiagramContext::remove ( const QString &  key)

DiagramContext::remove.

Parameters
key
Here is the caller graph for this function:

◆ stringLongerThan()

bool DiagramContext::stringLongerThan ( const QString &  a,
const QString &  b 
)
staticprivate
Returns
True if a is longer than b, false otherwise.
Here is the caller graph for this function:

◆ toSettings()

void DiagramContext::toSettings ( QSettings &  settings,
const QString &  array_name 
) const

Export this context properties to settings by creating an array named array_name.

Here is the caller graph for this function:

◆ toXml()

void DiagramContext::toXml ( QDomElement &  e,
const QString &  tag_name = "property" 
) const

Export this context properties under the e XML element, using tags named tag_name (defaults to "property").

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validKeyRegExp()

QString DiagramContext::validKeyRegExp ( )
static
Returns
the regular expression used to check whether a given key is acceptable.
See also
keyIsAcceptable()
Here is the caller graph for this function:

◆ value()

QVariant DiagramContext::value ( const QString &  key) const
Here is the caller graph for this function:

Member Data Documentation

◆ m_content

QHash<QString, QVariant> DiagramContext::m_content
private

Diagram context data (key/value pairs)

◆ m_content_show

QHash<QString, bool> DiagramContext::m_content_show
private

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