1 | // Copyright (C) 2022 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QCANDBCFILEPARSER_P_H |
5 | #define QCANDBCFILEPARSER_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qcandbcfileparser.h" |
19 | #include "qcanmessagedescription.h" |
20 | |
21 | #include <QtCore/QHash> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QCanSignalDescription; |
26 | |
27 | class QCanDbcFileParserPrivate |
28 | { |
29 | public: |
30 | void reset(); |
31 | bool parseFile(const QString &fileName); |
32 | bool parseData(QStringView data); |
33 | bool processLine(const QStringView line); |
34 | bool parseMessage(const QStringView data); |
35 | QCanMessageDescription extractMessage(const QRegularExpressionMatch &match); |
36 | bool parseSignal(const QStringView data); |
37 | QCanSignalDescription extractSignal(const QRegularExpressionMatch &match); |
38 | void parseSignalType(const QStringView data); |
39 | void parseComment(const QStringView data); |
40 | void parseExtendedMux(const QStringView data); |
41 | void parseValueDescriptions(const QStringView data); |
42 | void postProcessSignalMultiplexing(); |
43 | |
44 | void addWarning(QString &&warning); |
45 | void addCurrentMessage(); |
46 | |
47 | QList<QCanMessageDescription> getMessages() const; |
48 | |
49 | QString m_fileName; |
50 | QCanDbcFileParser::Error m_error = QCanDbcFileParser::Error::None; |
51 | QString m_errorString; |
52 | QStringList m_warnings; |
53 | qsizetype m_lineOffset = 0; |
54 | bool m_isProcessingMessage = false; |
55 | bool m_seenExtraData = false; |
56 | QCanMessageDescription m_currentMessage; |
57 | QHash<QtCanBus::UniqueId, QCanMessageDescription> m_messageDescriptions; |
58 | QCanDbcFileParser::MessageValueDescriptions m_valueDescriptions; |
59 | }; |
60 | |
61 | QT_END_NAMESPACE |
62 | |
63 | #endif // QCANDBCFILEPARSER_P_H |
64 |