Debugger: Use QVarLengthArray for local buffer

Change-Id: I1bca338e0ffb850ca23bf5e1d1cd2fb85227ddda
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2023-02-24 11:06:54 +01:00
parent a1e9670541
commit f53f006301
2 changed files with 37 additions and 28 deletions

View File

@@ -8,6 +8,7 @@
#include <QString>
#include <QJsonValue>
#include <QJsonObject>
#include <QVarLengthArray>
#include <QVector>
#include <utils/filepath.h>
@@ -105,6 +106,8 @@ class DebuggerOutputParser
public:
explicit DebuggerOutputParser(const QString &output);
using Buffer = QVarLengthArray<char, 30>;
QChar current() const { return *from; }
bool isCurrent(QChar c) const { return *from == c; }
bool isAtEnd() const { return from >= to; }
@@ -116,6 +119,8 @@ public:
int readInt();
QChar readChar();
QString readCString();
void readCStringData(Buffer &buffer);
QStringView readString(const std::function<bool(char)> &isValidChar);
QStringView buffer() const { return QStringView(from, to - from); }