Carousel
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
XmlDefinitionParser Class Reference

The XmlDefinitionParser class parses component definition using xml format. More...

#include <XmlDefinitionParser.h>

Inherits QObject, and IDefinitionParser.

Public Member Functions

 XmlDefinitionParser (QObject *parent=nullptr)
 
const QStringcomponentLocation () const
 
const QStringcomponentName () const
 
const QStringcomponentShortName () const
 
const QStringdescription () const
 
const QStringerror () const
 
const ParentsList & parents () const
 
const QStringproductName () const
 
const QStringprovider () const
 
bool read (const QString &text)
 
bool read (const QByteArray &data)
 
bool read (QIODevice *dev)
 
const QStringversion () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Protected Member Functions

void clear ()
 
virtual bool parseXml (QDomDocument &document)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

QString m_componentLocation
 
QString m_componentName
 
QString m_description
 
QString m_error
 
ParentsList m_parents
 
QString m_productName
 
QString m_provider
 
QString m_shortName
 
QString m_version
 

Additional Inherited Members

- Public Types inherited from IDefinitionParser
typedef QMap< QString, QStringParentsList
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The XmlDefinitionParser class parses component definition using xml format.

The XML should be like such one:

* <component name="MyComponent" shortName="Visible name of component">
* <version>1.2.3.4</version>
* <productName>My super product</productName>
* <provider>CarouselTeam</provider>
* <description>Ultra feature</description>
* <location>./MyComponent</location>
* <parentComponent name="ComponentA"/>
* <parentComponent name="ComponentC"/>
* <parentComponent name="ComponentB"/>
* </parents>
* </component>
*

Where name attribute is a componentName(), productName tag is a productName(), and so on.

The XmlDefinitionParser expects that root element is named component and has non-empty attribute name. All other tags are optional, so minimalistic xml-definition is like

* <component name="MyComponent>
* </component>
*

If version was not set, a default one (1.0.0) will be set during a ComponentDefinition creation.

Member Function Documentation

const QString& XmlDefinitionParser::error ( ) const
virtual

Gets the error occurred during reading (method read()). Returns empty string if error was not occurred.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::componentShortName ( ) const
virtual

Gets the component Id.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::componentName ( ) const
virtual

Gets the parsed component name.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::componentLocation ( ) const
virtual

Gets the parsed component location (relative or absolyte) without library extension.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::description ( ) const
virtual

Gets the parsed component description. Optional, can be empty string.

Implements IDefinitionParser.

const ParentsList& XmlDefinitionParser::parents ( ) const
virtual

Gets the parsed component parents names. Optional, can be empty list.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::productName ( ) const
virtual

Gets the parsed product name. Optional, can be empty string.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::provider ( ) const
virtual

Gets the name of component's provider - the person or company, who created this component.

Implements IDefinitionParser.

const QString& XmlDefinitionParser::version ( ) const
virtual

Gets the string representation of version of a component.

Implements IDefinitionParser.

bool XmlDefinitionParser::read ( const QString text)
virtual

This function parses the xml string text and sets component meta information.

If a parse error occurs (incorrect format, missing xml tags or attributes, etc), this function returns false. The error message could be got through error() method.

Implements IDefinitionParser.

bool XmlDefinitionParser::read ( QIODevice dev)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Implements IDefinitionParser.

virtual bool XmlDefinitionParser::parseXml ( QDomDocument document)
protectedvirtual

Sets up component information using ready-to-use document.

If a parse error occurs (missing xml tags or attributes, etc), this function returns false.

See Also
read();