Rework documentation of cbordump example
Focus the phrasing on what it teaches - how to use the stream reader - more than the example application of that, displaying it. Update docs: * Changed name to conform to modern guidelines. * Consistently mark \c cbodrump as code. * Fix mentions of CborDumper and CborTagDescription to match code. * Say how the tagDescriptions table is used. Task-number: QTBUG-111228 Change-Id: Ic12e77cf34caadc9f60527e886f94c76cb8cfeaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 5c2245cd66894cc27d6d4afcf13499db6434ee2e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c88b6acdd0
commit
72d703a521
@ -3,37 +3,37 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\example serialization/cbordump
|
\example serialization/cbordump
|
||||||
\title Cbordump Example
|
\title Parsing and displaying CBOR data
|
||||||
|
|
||||||
\brief The Cbordump example demonstrates how to parse files in CBOR-format.
|
\brief A demonstration of how to parse files in CBOR format.
|
||||||
|
|
||||||
The Cbordump example reads from files or stdin content in CBOR-format and
|
This example shows how to use the QCborStreamReader class directly to parse
|
||||||
dumps the decoded content to stdout. The cbordump utility can output in
|
CBOR content. The \c cbordump program reads content in CBOR format from
|
||||||
CBOR diagnostic notation (which is similar to JSON), or it can have a
|
files or standard input and dumps the decoded content to stdout in a
|
||||||
verbose output where each byte input is displayed with the encoding beside
|
human-readable format. It can output in CBOR diagnostic notation (which is
|
||||||
it. This example shows how to use the QCborStreamReader class directly to
|
similar to JSON), or it can produce a verbose output where each byte input
|
||||||
parse CBOR content.
|
is displayed with its encoding beside it.
|
||||||
|
|
||||||
\sa QCborStreamReader
|
\sa QCborStreamReader
|
||||||
|
|
||||||
\image cbordump.png
|
\image cbordump.png
|
||||||
|
|
||||||
\section1 The Cbordumper Class
|
\section1 The CborDumper Class
|
||||||
|
|
||||||
The Cbordumper class contains a QCborStreamReader object that is
|
The CborDumper class contains a QCborStreamReader object that is initialized
|
||||||
initialized using the QFile object argument passed to the CborDumper
|
using the QFile object argument passed to the CborDumper constructor. Based
|
||||||
constructor. Based on the arguments the dump function calls either
|
on the arguments the dump function calls either dumpOne() or
|
||||||
dumpOne() or dumpOneDetailed() to dump the contents to stdout,
|
dumpOneDetailed() to dump the contents to standard output,
|
||||||
|
|
||||||
\snippet serialization/cbordump/main.cpp 0
|
\snippet serialization/cbordump/main.cpp 0
|
||||||
|
|
||||||
\section2 The dumpOne() Function
|
\section2 The dumpOne() Function
|
||||||
|
|
||||||
The type() function of the QCborStreamReader is used in a switch statement
|
Switching on QCborStreamReader::type() enables printing appropriate to the
|
||||||
to print out for each type. If the type is an array or map, the content is
|
type of the current value in the stream. If the type is an array or map, the
|
||||||
iterated upon, and for each entry the dumpOne() function is called
|
value's content is iterated over, and for each entry the dumpOne() function
|
||||||
recursively with a higher indentation argument. If the type is a tag, it
|
is called recursively with a higher indentation argument. If the type is a
|
||||||
is printed out and dumpOne() is called once without increasing the
|
tag, it is printed out and dumpOne() is called once without increasing the
|
||||||
indentation argument.
|
indentation argument.
|
||||||
|
|
||||||
\section2 The dumpOneDetailed() Function
|
\section2 The dumpOneDetailed() Function
|
||||||
@ -42,11 +42,12 @@
|
|||||||
on the same line. It uses lambda functions to print out the bytes and
|
on the same line. It uses lambda functions to print out the bytes and
|
||||||
decoded content, but otherwise has a similar structure as dumpOne().
|
decoded content, but otherwise has a similar structure as dumpOne().
|
||||||
|
|
||||||
\section1 CborDescription
|
\section1 CborTagDescription
|
||||||
|
|
||||||
The tagDescriptions table, describing the CBOR-tags available, is
|
The \c tagDescriptions table, describing the CBOR tags available, is
|
||||||
automatically generated from an XML-file available from the iana.org
|
automatically generated from an XML file available from the iana.org
|
||||||
website.
|
website. When \c dumpOneDetailed() reports a tag, it uses its description
|
||||||
|
from this table.
|
||||||
|
|
||||||
\sa {CBOR Support in Qt}
|
\sa {CBOR Support in Qt}
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user