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
23QT_BEGIN_NAMESPACE
24
25class QCanSignalDescription;
26
27class QCanDbcFileParserPrivate
28{
29public:
30 void reset();
31 bool parseFile(const QString &fileName);
32 bool processLine(const QStringView line);
33 bool parseMessage(const QStringView data);
34 QCanMessageDescription extractMessage(const QRegularExpressionMatch &match);
35 bool parseSignal(const QStringView data);
36 QCanSignalDescription extractSignal(const QRegularExpressionMatch &match);
37 void parseSignalType(const QStringView data);
38 void parseComment(const QStringView data);
39 void parseExtendedMux(const QStringView data);
40 void parseValueDescriptions(const QStringView data);
41 void postProcessSignalMultiplexing();
42
43 void addWarning(QString &&warning);
44 void addCurrentMessage();
45
46 QList<QCanMessageDescription> getMessages() const;
47
48 QString m_fileName;
49 QCanDbcFileParser::Error m_error = QCanDbcFileParser::Error::None;
50 QString m_errorString;
51 QStringList m_warnings;
52 qsizetype m_lineOffset = 0;
53 bool m_isProcessingMessage = false;
54 bool m_seenExtraData = false;
55 QCanMessageDescription m_currentMessage;
56 QHash<QtCanBus::UniqueId, QCanMessageDescription> m_messageDescriptions;
57 QCanDbcFileParser::MessageValueDescriptions m_valueDescriptions;
58};
59
60QT_END_NAMESPACE
61
62#endif // QCANDBCFILEPARSER_P_H
63

source code of qtserialbus/src/serialbus/qcandbcfileparser_p.h