Line data Source code
1 : // SPDX-FileCopyrightText: 2013-2025 Paul Colby <git@colby.id.au>
2 : // SPDX-License-Identifier: LGPL-3.0-or-later
3 :
4 : /*!
5 : * \file
6 : * Declares the ShapePrivate class.
7 : */
8 :
9 : #ifndef QTSMITHY_SHAPE_P_H
10 : #define QTSMITHY_SHAPE_P_H
11 :
12 : #include <qtsmithy/shape.h>
13 : #include <qtsmithy/shapeid.h>
14 :
15 : #include <QLoggingCategory>
16 :
17 : QTSMITHY_BEGIN_NAMESPACE
18 :
19 0 : class QTSMITHY_EXPORT ShapePrivate
20 : {
21 0 : Q_DECLARE_TR_FUNCTIONS(Shape);
22 :
23 : public:
24 : explicit ShapePrivate(Shape * const q);
25 :
26 : static Shape::Type getType(const QJsonObject &ast);
27 : static Shape::Type getType(const QString &type);
28 :
29 : static Shape::Member getMember(const QJsonObject &ast, const QString &name);
30 : static ShapeIdStringMap getShapeIdStrMap(const QJsonObject &ast, const QString &name);
31 : static Shape::ShapeReference getShapeRef(const QJsonObject &ast, const QString &name);
32 : static Shape::ShapeReferences getShapeRefs(const QJsonObject &ast, const QString &name);
33 : static Shape::StringMemberMap getStrMemberMap(const QJsonObject &ast, const QString &name);
34 : static Shape::StringShapeRefMap getStrShapeRefMap(const QJsonObject &ast, const QString &name);
35 : static Shape::TraitsMap getTraitsMap(const QJsonObject &ast, const QString &name);
36 : static QString getString(const QJsonObject &ast, const QString &name);
37 :
38 : static QStringList supportedProperties(const Shape::Type &type);
39 : static QStringList requiredProperties(const Shape::Type &type);
40 :
41 : static bool validateIdentifier(const QString &id);
42 : static bool validateProperty(const QString &name, const QJsonValue &value);
43 :
44 : protected:
45 : Shape * q_ptr; ///< Internal q-pointer.
46 0 : static Q_LOGGING_CATEGORY(lc, "smithy.Shape", QtInfoMsg); ///< Logging category for Shape.
47 :
48 : private:
49 : QJsonObject ast;
50 : Shape::Error error;
51 : ShapeId id;
52 : Shape::Type type;
53 :
54 : Q_DECLARE_PUBLIC(Shape)
55 : QTSMITHY_BEFRIEND_TEST(Shape)
56 : };
57 :
58 : QTSMITHY_END_NAMESPACE
59 :
60 : #endif // QTSMITHY_SHAPE_P_H
|