diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 47d455dd55be855e4cc691c32f687f723d9247ee (patch) | |
tree | 52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmxmlhelper.h | |
download | tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmxmlhelper.h')
-rw-r--r-- | kpovmodeler/pmxmlhelper.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/kpovmodeler/pmxmlhelper.h b/kpovmodeler/pmxmlhelper.h new file mode 100644 index 00000000..25ae6947 --- /dev/null +++ b/kpovmodeler/pmxmlhelper.h @@ -0,0 +1,121 @@ +//-*-C++-*- +/* +************************************************************************** + description + -------------------- + copyright : (C) 2000-2002 by Andreas Zehender + email : zehender@kde.org +************************************************************************** + +************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +**************************************************************************/ + +#ifndef PMXMLHELPER_H +#define PMXMLHELPER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qdom.h> +#include <qstring.h> + +#include "pmobject.h" +#include "pmcolor.h" +#include "pmvector.h" +#include "pmmatrix.h" + +class PMPart; +class PMParser; + +/** + * Class for reading attributes out of a @ref QDomElement + */ +class PMXMLHelper +{ +public: + /** + * Creates a PMXMLHelper for the QDomElement& e + */ + PMXMLHelper( const QDomElement& e, PMPart* p, PMParser* par, + int majorDocumentFormat, int minorDocumentFormat ); + /** + * Returns the QDomElement + */ + QDomElement element( ) const { return m_e; } + + /** + * Returns true if the element contains the attribute + */ + bool hasAttribute( const QString& name ) const; + /** + * Reads an integer attribute + */ + int intAttribute( const QString& name, int def ) const; + /** + * Reads a double attribute + */ + double doubleAttribute( const QString& name, double def ) const; + /** + * Reads a bool attribute + */ + bool boolAttribute( const QString& name, bool def ) const; + /** + * Reads a PMThreeState attribute + */ + PMThreeState threeStateAttribute( const QString& name ) const; + /** + * Reads a string attribute + */ + QString stringAttribute( const QString& name, const QString& def ) const; + /** + * Reads a vector attribute + */ + PMVector vectorAttribute( const QString& name, const PMVector& def ) const; + /** + * Reads a matrix attribute + */ + PMMatrix matrixAttribute( const QString& name, const PMMatrix& def ) const; + /** + * Reads a color attribute + */ + PMColor colorAttribute( const QString& name, const PMColor& def ) const; + + /** + * Returns the "extra_data" child element or a null element, if there + * is no child element with tag name "extra_data" + */ + QDomElement extraData( ) const; + + /** + * Returns a pointer to the part + */ + PMPart* part( ) const { return m_pPart; } + /** + * Returns a pointer to the parser + */ + PMParser* parser( ) const { return m_pParser; } + /** + * Returns the documents major format number + */ + int majorDocumentFormat( ) const { return m_major; } + /** + * Returns the documents minor format number + */ + int minorDocumentFormat( ) const { return m_minor; } + +private: + QDomElement m_e; + PMPart* m_pPart; + PMParser* m_pParser; + int m_major; + int m_minor; +}; + +#endif |