Smithy Qt 0.1.0-pre
Internal development documentation
Loading...
Searching...
No Matches
shape_p.h
Go to the documentation of this file.
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
18
20{
21Q_DECLARE_TR_FUNCTIONS(Shape);
22
23public:
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
44protected:
45 Shape * q_ptr; ///< Internal q-pointer.
46 static Q_LOGGING_CATEGORY(lc, "smithy.Shape", QtInfoMsg); ///< Logging category for Shape.
47
48private:
49 QJsonObject ast;
50 Shape::Error error;
51 ShapeId id;
52 Shape::Type type;
53
54 Q_DECLARE_PUBLIC(Shape)
56};
57
59
60#endif // QTSMITHY_SHAPE_P_H
The ShapeId class provides a Qt representation of a Smithy Shape ID.
Definition shapeid.h:29
static Q_LOGGING_CATEGORY(lc, "smithy.Shape", QtInfoMsg)
Logging category for Shape.
Shape * q_ptr
Internal q-pointer.
Definition shape_p.h:45
ShapePrivate(Shape *const q)
Definition shape.cpp:309
The Shape class provides a Qt representation of a Smithy semantic shape.
Definition shape.h:25
Type
Definition shape.h:37
#define QTSMITHY_EXPORT
QtSmithy library export/import macro.
#define QTSMITHY_BEGIN_NAMESPACE
Macro for starting the QtSmithy library's top-most namespace (if one is defined).
#define QTSMITHY_BEFRIEND_TEST(Class)
Macro for befriending a related unit test class, but only when QT_TESTLIB_LIB is defined.
#define QTSMITHY_END_NAMESPACE
Macro for ending the QtSmithy library's top-most namespace (if one is defined).
Declares the Shape class.
Declares the ShapeId class.