* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+
#include <kdebug.h>
#include "chemicaldataobject.h"
-//########################
-ChemicalDataObjectPrivate::ChemicalDataObjectPrivate()
+class ChemicalDataObjectPrivate : public QSharedData
{
-}
+ public:
+ ChemicalDataObjectPrivate();
+ ~ChemicalDataObjectPrivate();
+
+ QVariant m_value;
+ QVariant m_errorValue;
+ ChemicalDataObject::BlueObelisk m_type;
+ ChemicalDataObject::BlueObeliskUnit m_unit;
+};
-ChemicalDataObjectPrivate::ChemicalDataObjectPrivate(const ChemicalDataObjectPrivate &other)
-: QSharedData(other)
+//########################
+ChemicalDataObjectPrivate::ChemicalDataObjectPrivate()
+: QSharedData()
{
}
//##############
ChemicalDataObject::ChemicalDataObject( const QVariant& v, BlueObelisk type, const QVariant& errorValue )
+ : d(new ChemicalDataObjectPrivate)
{
- d = new ChemicalDataObjectPrivate;
d->m_value = v;
d->m_errorValue = errorValue;
d->m_type = type;
}
ChemicalDataObject::ChemicalDataObject()
+ : d(new ChemicalDataObjectPrivate)
{
- d = new ChemicalDataObjectPrivate;
d->m_errorValue = QVariant();
d->m_unit = ChemicalDataObject::noUnit;
}
+ChemicalDataObject::ChemicalDataObject(const ChemicalDataObject &other)
+ : d(other.d)
+{
+}
+
+ChemicalDataObject::~ChemicalDataObject()
+{
+}
+
+ChemicalDataObject& ChemicalDataObject::operator=(const ChemicalDataObject &other)
+{
+ d = other.d;
+ return *this;
+}
+
bool ChemicalDataObject::operator==( const int v ) const
{
if ( d->m_value.type() != QVariant::Int )
return d->m_value.toString() == v;
}
+bool ChemicalDataObject::operator==(const ChemicalDataObject &other) const
+{
+ return d == other.d;
+}
+
+bool ChemicalDataObject::operator!=(const ChemicalDataObject &other) const
+{
+ return d != other.d;
+}
+
QString ChemicalDataObject::valueAsString() const
{
return d->m_value.toString();
BlueObelisk type,
const QVariant& errorValue = QVariant(0) );
+ /**
+ * Copy constructor.
+ */
+ ChemicalDataObject(const ChemicalDataObject &other);
+
+ /**
+ * Destructor.
+ */
+ ~ChemicalDataObject();
+
/**
* Set the data of this object to @p v
* @param v the value of the object
*/
static BlueObeliskUnit unit( const QString& unitname );
+ ChemicalDataObject& operator=(const ChemicalDataObject &other);
+
+ bool operator==(const ChemicalDataObject &other) const;
+
+ bool operator!=(const ChemicalDataObject &other) const;
+
private:
QSharedDataPointer<ChemicalDataObjectPrivate> d;
};
-class SCIENCE_EXPORT ChemicalDataObjectPrivate : public QSharedData
-{
- public:
- ChemicalDataObjectPrivate();
- ChemicalDataObjectPrivate(const ChemicalDataObjectPrivate &other);
- ~ChemicalDataObjectPrivate();
-
- QVariant m_value;
- QVariant m_errorValue;
- ChemicalDataObject::BlueObelisk m_type;
- ChemicalDataObject::BlueObeliskUnit m_unit;
-};
#endif // CHEMICALDATAOBJECT_H