1 | // Copyright (C) 2017 Ford Motor Company |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #include <qiodevice.h> |
5 | #include <qjsonarray.h> |
6 | #include <qjsonvalue.h> |
7 | |
8 | #include "cppcodegenerator.h" |
9 | #include "utils.h" |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | CppCodeGenerator::CppCodeGenerator(QIODevice *outputDevice) |
14 | : m_outputDevice(outputDevice) |
15 | { |
16 | Q_ASSERT(m_outputDevice); |
17 | } |
18 | |
19 | void CppCodeGenerator::generate(const QJsonArray &classList, bool alwaysGenerateClass /* = false */) |
20 | { |
21 | for (const QJsonValue cdef : classList) |
22 | m_outputDevice->write(data: generateClass(cls: cdef, alwaysGenerateClass)); |
23 | |
24 | m_outputDevice->write(data: "\n"); |
25 | } |
26 | |
27 | QT_END_NAMESPACE |
28 |