Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
raw_json_scanner.h
Go to the documentation of this file.
1#ifndef RAW_JSON_SCANNER_H
2#define RAW_JSON_SCANNER_H
3
4#include <QList>
5#include <QString>
6#include <QtGlobal>
7#include <functional>
8
9class QByteArray;
10
11namespace RawJson
12{
13
20{
22 qsizetype start = -1;
24 qsizetype length = 0;
26 int cardCount = 0;
27};
28
30{
33 QString code;
34 QString name;
35 QString type;
36 QString releaseDate;
37};
38
40{
41 bool isError() const
42 {
43 return !message.isEmpty();
44 }
45 QString message;
46};
47
53using ScanProgressCallback = std::function<void(qsizetype bytesRead, qsizetype totalBytes)>;
54
85QList<SetRange> scanSetRanges(const QByteArray &json,
86 ScanError *error = nullptr,
87 const ScanProgressCallback &progress = ScanProgressCallback());
88
89} // namespace RawJson
90
91#endif // RAW_JSON_SCANNER_H
Definition remote_connection_controller.h:20
Definition raw_json_scanner.cpp:559
std::function< void(qsizetype bytesRead, qsizetype totalBytes)> ScanProgressCallback
Optional progress callback receiving (bytesRead, totalBytes) while the document is walked....
Definition raw_json_scanner.h:53
QList< SetRange > scanSetRanges(const QByteArray &json, ScanError *error, const ScanProgressCallback &progress)
Scans a full MTGJSON document without materializing the JSON tree.
Definition raw_json_scanner.cpp:561
Definition raw_json_scanner.h:40
QString message
Definition raw_json_scanner.h:45
bool isError() const
Definition raw_json_scanner.h:41
The byte extent of a set's object inside the scanned document, plus the size of its cards array....
Definition raw_json_scanner.h:20
qsizetype length
Byte length of the set's object, including the surrounding braces.
Definition raw_json_scanner.h:24
qsizetype start
Byte offset of the set's object within the scanned buffer.
Definition raw_json_scanner.h:22
int cardCount
Number of entries in the set's "cards" array.
Definition raw_json_scanner.h:26
Definition raw_json_scanner.h:30
QString type
Definition raw_json_scanner.h:35
QString name
Definition raw_json_scanner.h:34
QString code
Definition raw_json_scanner.h:33
SetDataRange dataRange
The byte slice of this set within the document.
Definition raw_json_scanner.h:32
QString releaseDate
Definition raw_json_scanner.h:36