Nuria Framework - Core
Core module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator Groups
jsonmetaobjectreader.hpp
1 /* Copyright (c) 2014, The Nuria Project
2  * This software is provided 'as-is', without any express or implied
3  * warranty. In no event will the authors be held liable for any damages
4  * arising from the use of this software.
5  * Permission is granted to anyone to use this software for any purpose,
6  * including commercial applications, and to alter it and redistribute it
7  * freely, subject to the following restrictions:
8  * 1. The origin of this software must not be misrepresented; you must not
9  * claim that you wrote the original software. If you use this software
10  * in a product, an acknowledgment in the product documentation would be
11  * appreciated but is not required.
12  * 2. Altered source versions must be plainly marked as such, and must not be
13  * misrepresented as being the original software.
14  * 3. This notice may not be removed or altered from any source
15  * distribution.
16  */
17 
18 #ifndef NURIA_JSONMETAOBJECTREADER_HPP
19 #define NURIA_JSONMETAOBJECTREADER_HPP
20 
21 #include <QSharedData>
22 #include <QStringList>
23 #include <QString>
24 
25 #include "essentials.hpp"
26 #include "metaobject.hpp"
27 
28 namespace Nuria {
29 
30 class JsonMetaObjectReaderPrivate;
31 
56 class NURIA_CORE_EXPORT JsonMetaObjectReader : public QObject {
57  Q_OBJECT
58  Q_ENUMS(Error)
59 public:
60 
64  enum Error {
65  NoError = 0,
67 
70 
73  TypeIsNotAnObject,
74 
79  AnnotationsIsNotAnArray,
80  BasesIsNotAnArray,
81  ConstructorsIsNotAnArray,
82  MemberMethodsIsNotAnArray,
83  StaticMethodsIsNotAnArray,
84  EnumsIsNotAnObject,
85  FieldsIsNotAnObject,
86  BasesContainsNonString,
93  AnnotationIsNotAnObject,
94  AnnotationNameIsNotAString,
95 
108  MethodIsNotAnObject,
109  MethodNameIsNotAString,
110  MethodResultTypeIsNotAString,
111 
114  MethodArgumentNamesIsNotAnArray,
115  MethodArgumentNamesContainsNonString,
116  MethodArgumentTypesIsNotAnArray,
117  MethodArgumentTypesContainsNonString,
124  EnumIsNotAnObject,
125  EnumValuesIsNotAnObject,
126  EnumValueObjectValueIsNotAnInteger,
133  FieldIsNotAnObject,
134  FieldTypeIsNotAString,
135  FieldReadOnlyIsNotABoolean
138  };
139 
141  explicit JsonMetaObjectReader (QObject *parent = 0);
142 
145 
151  Error parse (const QJsonDocument &jsonDocument);
152 
154  Error parse (const QJsonObject &root);
155 
157  Error parse (const QByteArray &jsonData);
158 
163  QStringList sourceFiles ();
164 
169  MetaObjectMap metaObjects (const QString &sourceFile);
170 
171 private:
172  JsonMetaObjectReaderPrivate *d_ptr;
173 };
174 
175 }
176 
177 #endif // NURIA_JSONMETAOBJECTREADER_HPP
The raw JSON data failed to parse.
Definition: jsonmetaobjectreader.hpp:66
Definition: jsonmetaobjectreader.hpp:69
JsonMetaObjectReader is a parser for MetaObject data stored in JSON format as generated by Tria...
Definition: jsonmetaobjectreader.hpp:56
Error
Definition: jsonmetaobjectreader.hpp:64
Definition: jsonmetaobjectreader.hpp:72
Definition: jsonmetaobjectreader.hpp:101