diff options
Diffstat (limited to 'g_object.cpp')
| -rw-r--r-- | g_object.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/g_object.cpp b/g_object.cpp index 09cbc27..bf7f6b0 100644 --- a/g_object.cpp +++ b/g_object.cpp @@ -5,32 +5,32 @@ #include <QLineF> #include <QPointF> -G_Object::G_Object(QObject* parent) +goodies::G_Object::G_Object(QObject* parent) : QObject(parent) { } -G_Object::G_Object(const QJsonObject& json, QObject* parent) +goodies::G_Object::G_Object(const QJsonObject& json, QObject* parent) : QObject(parent) { // use G_Object static offset, not virtual constructFromJson(json); } -G_Object::G_Object(const QJsonValue& json, QObject* parent) +goodies::G_Object::G_Object(const QJsonValue& json, QObject* parent) : QObject(parent) { constructFromJson(json.toObject()); } -G_Object::G_Object(const G_Object& other, QObject* parent) +goodies::G_Object::G_Object(const goodies::G_Object& other, QObject* parent) : QObject(parent) { // NOTE: always G_Object's assignment operator will be called, not derived *this = other; } -G_Object& G_Object::operator=(const G_Object& other) +goodies::G_Object& goodies::G_Object::operator=(const goodies::G_Object& other) { // use G_Object static offset, not virtual for (int i = staticMetaObject.propertyOffset(); @@ -48,26 +48,26 @@ G_Object& G_Object::operator=(const G_Object& other) return *this; } -G_Object& G_Object::operator=(const QJsonObject& json) +goodies::G_Object& goodies::G_Object::operator=(const QJsonObject& json) { constructFromJson(json); return *this; } -G_Object& G_Object::operator=(const QJsonValue& json) +goodies::G_Object& goodies::G_Object::operator=(const QJsonValue& json) { constructFromJson(json.toObject()); return *this; } -G_Object::operator const QJsonValue() const +goodies::G_Object::operator const QJsonValue() const { return this->operator const QJsonObject(); } -bool G_Object::operator==(const G_Object& other) const +bool goodies::G_Object::operator==(const goodies::G_Object& other) const { for (int i = staticMetaObject.propertyOffset(); i < metaObject()->propertyCount(); @@ -84,7 +84,7 @@ bool G_Object::operator==(const G_Object& other) const return true; } -bool G_Object::constructFromJson(const QJsonObject& json) +bool goodies::G_Object::constructFromJson(const QJsonObject& json) { auto offset = staticMetaObject.propertyOffset(); auto properiesCount = metaObject()->propertyCount(); @@ -120,8 +120,8 @@ bool G_Object::constructFromJson(const QJsonObject& json) { qDebug() << Q_FUNC_INFO << "cannot convert" << key << "property from type" - << QMetaType::typeName(variantValue.userType()) - << "to type" << QMetaType::typeName(type); + << QMetaType(variantValue.userType()).name() << "to type" + << QMetaType(type).name(); return false; } @@ -132,7 +132,7 @@ bool G_Object::constructFromJson(const QJsonObject& json) return true; } -G_Object::operator const QJsonObject() const +goodies::G_Object::operator const QJsonObject() const { QJsonObject result; @@ -154,7 +154,7 @@ G_Object::operator const QJsonObject() const if (!converted) { - qDebug() << "G_Object::operator const QJsonObject() const:" + qDebug() << "goodies::G_Object::operator const QJsonObject() const:" << "cannot convert" << key << "property from type" << QMetaType::typeName(value.userType()) << "to type" << QMetaType::typeName(type); @@ -166,7 +166,7 @@ G_Object::operator const QJsonObject() const return result; } -QDebug operator<<(QDebug d, const G_Object& o) +QDebug goodies::operator<<(QDebug d, const goodies::G_Object& o) { d << o.metaObject()->className() << ":\n"; |
