summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_serialization_qcborvalue.cpp
blob: 3abee048ab3c782bfb8f4e1c53accf4ca90289f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [0]
    QCborValue(uuid) == QCborValue(QCborKnownTags::Uuid, uuid.toRfc4122());
//! [0]

//! [1]
    QCborValue value(QCborSimpleType(12));
//! [1]

//! [2]
    value.isSimpleType(QCborSimpleType(12));
//! [2]

//! [3]
    QCborValue(QUrl("https://example.com")) == QCborValue(QCborKnownTags::Url, "https://example.com");
//! [3]

//! [4]
    value.toMap().value(key);
//! [4]

//! [5]
    value.toMap().value(key);
//! [5]

//! [6]
    if (reader.isTag() && reader.toTag() == QCborKnownTags::Signature)
        reader.next();

    QCborValue contents = QCborValue::fromCbor(reader);
//! [6]