summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2023-02-13 11:58:29 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-16 15:06:20 +0000
commit1bfc594c44b2e303ebd2f40eb1d402131689ccd8 (patch)
tree2caaaf58359e385712438677ece9cc970e961222 /src
parentcbc8780b8aba69f09c7562550a8332bd66db20f7 (diff)
Rename Error enums for QCanFrameProcessor & QCanDbcFileParser
This change is only applied to new API introduced to Qt 6.5. The new names reflect the fact that scoped enums already state the word "Error" in their "scope" due to their explicit C++ naming. Change-Id: Ie7e4e0f5450f6ee19da537dc936c6024853979f6 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 3e55105068f02613bf687ed61e4bd12eab603c81) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/serialbus/qcandbcfileparser.cpp16
-rw-r--r--src/serialbus/qcandbcfileparser.h6
-rw-r--r--src/serialbus/qcandbcfileparser_p.h2
-rw-r--r--src/serialbus/qcanframeprocessor.cpp22
-rw-r--r--src/serialbus/qcanframeprocessor.h6
-rw-r--r--src/serialbus/qcanframeprocessor_p.h2
6 files changed, 27 insertions, 27 deletions
diff --git a/src/serialbus/qcandbcfileparser.cpp b/src/serialbus/qcandbcfileparser.cpp
index df7e0fa..7733c37 100644
--- a/src/serialbus/qcandbcfileparser.cpp
+++ b/src/serialbus/qcandbcfileparser.cpp
@@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE
Call the \l error() method to get the error which occurred during the
parsing. If the parsing completes successfully, this method will return
- \l {QCanDbcFileParser::}{NoError}. Otherwise, you can use an
+ \l {QCanDbcFileParser::}{None}. Otherwise, you can use an
\l errorString() method to get the string representation of an error.
During the parsing some non-critical problems may occur as well. Such
@@ -128,9 +128,9 @@ QT_BEGIN_NAMESPACE
This enum represents the possible errors that can happen during the parsing
of a DBC file.
- \value NoError No error occurred.
- \value FileReadError An error occurred while opening or reading the file.
- \value ParseError An error occurred while parsing the content of the file.
+ \value None No error occurred.
+ \value FileReading An error occurred while opening or reading the file.
+ \value Parsing An error occurred while parsing the content of the file.
*/
/*!
@@ -311,7 +311,7 @@ static constexpr auto kCharStrRegExp = "((?![\\\"\\\\])[\x20-\x7e])*"_L1;
void QCanDbcFileParserPrivate::reset()
{
m_fileName.clear();
- m_error = QCanDbcFileParser::Error::NoError;
+ m_error = QCanDbcFileParser::Error::None;
m_errorString.clear();
m_warnings.clear();
m_lineOffset = 0;
@@ -331,7 +331,7 @@ bool QCanDbcFileParserPrivate::parseFile(const QString &fileName)
{
QFile f(fileName);
if (!f.open(QIODevice::ReadOnly)) {
- m_error = QCanDbcFileParser::Error::FileReadError;
+ m_error = QCanDbcFileParser::Error::FileReading;
m_errorString = f.errorString();
return false;
}
@@ -362,7 +362,7 @@ bool QCanDbcFileParserPrivate::processLine(const QStringView line)
if (data.startsWith(kMessageDef)) {
if (m_seenExtraData) {
// Unexpected position of message description
- m_error = QCanDbcFileParser::Error::ParseError;
+ m_error = QCanDbcFileParser::Error::Parsing;
m_errorString = QObject::tr("Failed to parse file %1. Unexpected position "
"of %2 section.").arg(m_fileName, kMessageDef);
return false;
@@ -377,7 +377,7 @@ bool QCanDbcFileParserPrivate::processLine(const QStringView line)
while (data.startsWith(kSignalDef)) {
if (!m_isProcessingMessage || m_seenExtraData) {
// Unexpected position of signal description
- m_error = QCanDbcFileParser::Error::ParseError;
+ m_error = QCanDbcFileParser::Error::Parsing;
m_errorString = QObject::tr("Failed to parse file %1. Unexpected position "
"of %2 section.").arg(m_fileName, kSignalDef);
return false;
diff --git a/src/serialbus/qcandbcfileparser.h b/src/serialbus/qcandbcfileparser.h
index 782c290..c279264 100644
--- a/src/serialbus/qcandbcfileparser.h
+++ b/src/serialbus/qcandbcfileparser.h
@@ -21,9 +21,9 @@ class QCanDbcFileParser
{
public:
enum class Error : quint8 {
- NoError = 0,
- FileReadError,
- ParseError
+ None = 0,
+ FileReading,
+ Parsing
};
// The DBC protocol uses unsigned_integer to describe the supported values.
diff --git a/src/serialbus/qcandbcfileparser_p.h b/src/serialbus/qcandbcfileparser_p.h
index 6381b39..90c763f 100644
--- a/src/serialbus/qcandbcfileparser_p.h
+++ b/src/serialbus/qcandbcfileparser_p.h
@@ -46,7 +46,7 @@ public:
QList<QCanMessageDescription> getMessages() const;
QString m_fileName;
- QCanDbcFileParser::Error m_error = QCanDbcFileParser::Error::NoError;
+ QCanDbcFileParser::Error m_error = QCanDbcFileParser::Error::None;
QString m_errorString;
QStringList m_warnings;
qsizetype m_lineOffset = 0;
diff --git a/src/serialbus/qcanframeprocessor.cpp b/src/serialbus/qcanframeprocessor.cpp
index 2a98496..72c2550 100644
--- a/src/serialbus/qcanframeprocessor.cpp
+++ b/src/serialbus/qcanframeprocessor.cpp
@@ -111,14 +111,14 @@ static quint16 extractMaxBitNum(quint16 startBit, quint16 bitLength, QSysInfo::E
This enum represents the possible errors that can occur while
encoding or decoding the \l QCanBusFrame.
- \value NoError No error occurred.
+ \value None No error occurred.
\value InvalidFrame The received frame is invalid and cannot be parsed.
\value UnsupportedFrameFormat The format of the received frame is not
supported and cannot be parsed.
- \value DecodingError An error occurred during decoding. Use
+ \value Decoding An error occurred during decoding. Use
\l errorString() to get a string representation
of the error.
- \value EncodingError An error occurred during encoding. Use
+ \value Encoding An error occurred during encoding. Use
\l errorString() to get a string representation
of the error.
*/
@@ -195,13 +195,13 @@ QCanBusFrame QCanFrameProcessor::prepareFrame(QtCanBus::UniqueId uniqueId,
d->resetErrors();
if (!d->uidDescription.isValid()) {
- d->setError(Error::EncodingError,
+ d->setError(Error::Encoding,
QObject::tr("No valid unique identifier description is specified."));
return QCanBusFrame(QCanBusFrame::InvalidFrame);
}
if (!d->messages.contains(uniqueId)) {
- d->setError(Error::EncodingError,
+ d->setError(Error::Encoding,
QObject::tr("Failed to find message description for unique id %1.").
arg(qToUnderlying(uniqueId)));
return QCanBusFrame(QCanBusFrame::InvalidFrame);
@@ -218,7 +218,7 @@ QCanBusFrame QCanFrameProcessor::prepareFrame(QtCanBus::UniqueId uniqueId,
unsigned char *data = uidInPayload ? reinterpret_cast<unsigned char *>(payload.data())
: reinterpret_cast<unsigned char *>(&canFrameId);
if (!d->fillUniqueId(data, bitsSize, uniqueId)) {
- d->setError(Error::EncodingError,
+ d->setError(Error::Encoding,
QObject::tr("Failed to encode unique id %1 into the frame").
arg(qToUnderlying(uniqueId)));
return QCanBusFrame(QCanBusFrame::InvalidFrame);
@@ -446,21 +446,21 @@ QCanFrameProcessor::ParseResult QCanFrameProcessor::parseFrame(const QCanBusFram
return {};
}
if (!d->uidDescription.isValid()) {
- d->setError(Error::DecodingError,
+ d->setError(Error::Decoding,
QObject::tr("No valid unique identifier description is specified."));
return {};
}
const auto uidOpt = d->extractUniqueId(frame);
if (!uidOpt.has_value()) {
- d->setError(Error::DecodingError,
+ d->setError(Error::Decoding,
QObject::tr("Failed to extract unique id from the frame."));
return {};
}
const auto uniqueId = uidOpt.value();
if (!d->messages.contains(uniqueId)) {
- d->setError(Error::DecodingError,
+ d->setError(Error::Decoding,
QObject::tr("Could not find a message description for unique id %1.").
arg(qToUnderlying(uniqueId)));
return {};
@@ -468,7 +468,7 @@ QCanFrameProcessor::ParseResult QCanFrameProcessor::parseFrame(const QCanBusFram
const auto message = d->messages.value(uniqueId);
if (message.size() != frame.payload().size()) {
- d->setError(Error::DecodingError,
+ d->setError(Error::Decoding,
QObject::tr("Payload size does not match message description. "
"Actual size = %1, expected size = %2.").
arg(frame.payload().size()).arg(message.size()));
@@ -538,7 +538,7 @@ QCanFrameProcessor::ParseResult QCanFrameProcessor::parseFrame(const QCanBusFram
void QCanFrameProcessorPrivate::resetErrors()
{
- error = QCanFrameProcessor::Error::NoError;
+ error = QCanFrameProcessor::Error::None;
errorString.clear();
warnings.clear();
}
diff --git a/src/serialbus/qcanframeprocessor.h b/src/serialbus/qcanframeprocessor.h
index ef5c552..bdfbde0 100644
--- a/src/serialbus/qcanframeprocessor.h
+++ b/src/serialbus/qcanframeprocessor.h
@@ -22,11 +22,11 @@ class QCanFrameProcessor
{
public:
enum class Error : quint8 {
- NoError = 0,
+ None = 0,
InvalidFrame,
UnsupportedFrameFormat,
- DecodingError,
- EncodingError,
+ Decoding,
+ Encoding,
};
struct ParseResult {
diff --git a/src/serialbus/qcanframeprocessor_p.h b/src/serialbus/qcanframeprocessor_p.h
index 361a726..cd01be2 100644
--- a/src/serialbus/qcanframeprocessor_p.h
+++ b/src/serialbus/qcanframeprocessor_p.h
@@ -42,7 +42,7 @@ public:
static QCanFrameProcessorPrivate *get(const QCanFrameProcessor &processor);
- QCanFrameProcessor::Error error = QCanFrameProcessor::Error::NoError;
+ QCanFrameProcessor::Error error = QCanFrameProcessor::Error::None;
QString errorString;
QStringList warnings;
QHash<QtCanBus::UniqueId, QCanMessageDescription> messages;