#include "kkj.h"
+#include "kkj_p.h"
+
+KKJPrivate::~KKJPrivate()
+{
+}
+
+void KKJPrivate::init(unsigned int northing, unsigned int easting)
+{
+ this->northing = northing;
+ this->easting = easting;
+}
+
KKJ::KKJ(unsigned int northing, unsigned int easting) :
- mNorthing(northing),
- mEasting(easting)
+ d_ptr(new KKJPrivate)
+{
+ Q_D(KKJ);
+ d->q_ptr = this;
+ d->init(northing, easting);
+}
+
+KKJ::KKJ(KKJPrivate &dd, unsigned int northing, unsigned int easting) :
+ d_ptr(&dd)
{
+ Q_D(KKJ);
+ d->q_ptr = this;
+ d->init(northing, easting);
}
KKJ::~KKJ()
unsigned int KKJ::northing() const
{
- return mNorthing;
+ Q_D(const KKJ);
+ return d->northing;
}
unsigned int KKJ::easting() const
{
- return mEasting;
+ Q_D(const KKJ);
+ return d->easting;
}
#ifndef KKJ_H
#define KKJ_H
+#include <QtGlobal>
+
+class KKJPrivate;
+
/**
* A class representing the Finnish KKJ coordinate.
*/
*/
unsigned int easting() const;
+protected:
+ /**
+ * Constructs a new KKJ coordinate with the given values.
+ * @param dd a private implementation member.
+ * @param northing the northing coordinate.
+ * @param easting the easting coordinate.
+ */
+ KKJ(KKJPrivate &dd, unsigned int northing, unsigned int easting);
+
+
private:
- unsigned int mNorthing;
- unsigned int mEasting;
+ /// Pointer to the private member
+ KKJPrivate *const d_ptr;
+
+ Q_DECLARE_PRIVATE(KKJ)
+
};
#endif // KKJ_H
--- /dev/null
+#ifndef KKJ_P_H
+#define KKJ_P_H
+
+#include <QtGlobal>
+
+class KKJ;
+
+/**
+ * A private member class for class KKJ.
+ */
+class KKJPrivate
+{
+public:
+ /**
+ * Destructor.
+ */
+ virtual ~KKJPrivate();
+
+private:
+ /**
+ * Initializes the private class.
+ * @param northing the northing of the coordinate.
+ * @param easting the easting of the coordinate.
+ */
+ void init(unsigned int northing, unsigned int easting);
+
+ /// The northing of the coordinate.
+ unsigned int northing;
+
+ /// The easting of the coordinate.
+ unsigned int easting;
+
+ /// The concrete class owning this private implementation member.
+ KKJ *q_ptr;
+
+ Q_DECLARE_PUBLIC(KKJ)
+
+};
+
+#endif // KKJ_P_H
TEMPLATE = lib
TARGET = ptascommon
-INSTALL_HEADERS += \
+INSTALL_HEADERS = \
kkj.h
+PRIVATE_HEADERS = \
+ kkj_p.h
HEADERS += \
- $$INSTALL_HEADERS
+ $$INSTALL_HEADERS \
+ $$PRIVATE_HEADERS
SOURCES += \
kkj.cpp