MCPcopy Create free account
hub / github.com/KDE/kdevelop / Source

Method Source

plugins/debuggercommon/tests/debuggees/qcbor.cpp:13–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11{
12public:
13 Source() {
14 QCborMap cborMap;
15 cborMap[QStringLiteral("name")] = "John Doe";
16 cborMap[QStringLiteral("address")] = "Some street\nCity\nCountry";
17 cborMap[QStringLiteral("year")] = 2024;
18 QCborValue age(30.57);
19 cborMap[QStringLiteral("age")] = age;
20 QCborValue notMarried(false);
21 cborMap[QStringLiteral("married")] = notMarried;
22 cborMap[QStringLiteral("undefined")] = QCborValue();
23 cborMap[QStringLiteral("null")] = QCborValue(nullptr);
24 QCborValue urlValue(QUrl("http://www.kde.org"));
25 cborMap[QStringLiteral("url")] = urlValue;
26 QUuid uuid("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}");
27 QCborValue uuidValue(uuid);
28 cborMap[QStringLiteral("uuid")] = uuidValue;
29 cborMap[QStringLiteral("regexp")] = QCborValue(QRegularExpression(QStringLiteral("^kde$")));
30 cborMap[QStringLiteral("birth")] = QCborValue(QDateTime(QDate(2001, 5, 30), QTime(9, 31, 0), QTimeZone(3600)));
31 cborMap[QStringLiteral("bytes")] = QByteArray("ABC\xFF\x00\xFE", 6);
32 QCborValue otherSimpleType(QCborSimpleType(12));
33 cborMap[QStringLiteral("otherSimpleType")] = otherSimpleType;
34
35 QCborMap childMap;
36 childMap[QStringLiteral("company")] = "KDAB";
37 childMap[QStringLiteral("title")] = "Surface technician";
38 childMap[QStringLiteral("emptyObj")] = QCborMap();
39 childMap[QStringLiteral("emptyArray")] = QCborArray();
40 // The byte value 0x01 followed by 8 zero bytes represents the number 2^64 (example from Qt API docs)
41 QCborValue bigNum(QCborTag(QCborKnownTags::PositiveBignum), QByteArray("\x01\0\0\0\0\0\0\0\0", 9));
42 childMap[QStringLiteral("bigNum")] = bigNum;
43 QCborMap taggedMap;
44 taggedMap[QStringLiteral("planet")] = QString("earth");
45 QCborValue tagWithMap(QCborTag(42), taggedMap);
46 childMap[QStringLiteral("tagWithMap")] = tagWithMap;
47
48 cborMap[QStringLiteral("job")] = childMap;
49
50 QCborArray childrenArray;
51 childrenArray.append("Alice");
52 childrenArray.append("Mickaël");
53 cborMap[QStringLiteral("children")] = childrenArray;
54
55 m_document = cborMap;
56 }
57
58 Q_NEVER_INLINE QCborValue documentValue();
59 Q_NEVER_INLINE QCborMap mainMap();

Callers

nothing calls this directly

Calls 5

QUrlClass · 0.50
QDateTimeClass · 0.50
QByteArrayClass · 0.50
QStringClass · 0.50
appendMethod · 0.45

Tested by

no test coverage detected