|
libpappsomspp
Library for mass spectrometry
|
helper class to write json text using CBOR data structures More...
#include <jsonstreamwriter.h>
Public Member Functions | |
| JsonStreamWriter (QIODevice *device) | |
| build a QTextStream for JSON writer | |
| virtual | ~JsonStreamWriter () |
| void | startArray () |
| starts an array in JSON output simply print "[" | |
| void | endArray () |
| ends an array in JSON output simply print "]" | |
| void | startMap () |
| start an object in JSON output simply print "{" | |
| void | endMap () |
| ends an object in JSON output simply print "}" | |
| void | writeCborMap (const QCborMap &cbor_map) |
| converts a CBOR map (object) into JSON text in output | |
| void | writeCborArray (const QCborArray &cbor_array) |
| converts a CBOR array (list) into JSON text in output | |
| void | appendKey (const QString &key) |
| writes a key (dictionary entry) to JSON text | |
| void | appendValue (const QString &value) |
| writes String value to JSON text | |
| void | appendValue (std::size_t integer_size_value) |
| writes an integer value to JSON text | |
| void | writeArray (QStringList &str_list) |
| convert a string list to a JSON array | |
Protected Member Functions | |
| void | comma () |
Private Attributes | |
| bool | m_isStart = true |
| bool | m_nextIsValue = false |
helper class to write json text using CBOR data structures
Definition at line 42 of file jsonstreamwriter.h.
| pappso::cbor::JsonStreamWriter::JsonStreamWriter | ( | QIODevice * | device | ) |
build a QTextStream for JSON writer
Definition at line 35 of file jsonstreamwriter.cpp.
|
virtual |
| void pappso::cbor::JsonStreamWriter::appendKey | ( | const QString & | key | ) |
writes a key (dictionary entry) to JSON text
Definition at line 96 of file jsonstreamwriter.cpp.
References comma(), m_isStart, and m_nextIsValue.
| void pappso::cbor::JsonStreamWriter::appendValue | ( | const QString & | value | ) |
writes String value to JSON text
Definition at line 106 of file jsonstreamwriter.cpp.
References m_nextIsValue.
| void pappso::cbor::JsonStreamWriter::appendValue | ( | std::size_t | integer_size_value | ) |
writes an integer value to JSON text
Definition at line 113 of file jsonstreamwriter.cpp.
References m_nextIsValue.
|
protected |
Definition at line 127 of file jsonstreamwriter.cpp.
References m_isStart.
Referenced by appendKey(), startArray(), and startMap().
| void pappso::cbor::JsonStreamWriter::endArray | ( | ) |
ends an array in JSON output simply print "]"
Definition at line 44 of file jsonstreamwriter.cpp.
References m_isStart, and m_nextIsValue.
| void pappso::cbor::JsonStreamWriter::endMap | ( | ) |
ends an object in JSON output simply print "}"
Definition at line 52 of file jsonstreamwriter.cpp.
References m_isStart, and m_nextIsValue.
| void pappso::cbor::JsonStreamWriter::startArray | ( | ) |
starts an array in JSON output simply print "["
Definition at line 60 of file jsonstreamwriter.cpp.
References comma(), m_isStart, and m_nextIsValue.
| void pappso::cbor::JsonStreamWriter::startMap | ( | ) |
start an object in JSON output simply print "{"
Definition at line 68 of file jsonstreamwriter.cpp.
References comma(), m_isStart, and m_nextIsValue.
| void pappso::cbor::JsonStreamWriter::writeArray | ( | QStringList & | str_list | ) |
convert a string list to a JSON array
Definition at line 121 of file jsonstreamwriter.cpp.
| void pappso::cbor::JsonStreamWriter::writeCborArray | ( | const QCborArray & | cbor_array | ) |
converts a CBOR array (list) into JSON text in output
| cbor_array | the map to convert |
Definition at line 86 of file jsonstreamwriter.cpp.
| void pappso::cbor::JsonStreamWriter::writeCborMap | ( | const QCborMap & | cbor_map | ) |
converts a CBOR map (object) into JSON text in output
| cbor_map | the map to convert |
Definition at line 77 of file jsonstreamwriter.cpp.
|
private |
Definition at line 114 of file jsonstreamwriter.h.
Referenced by appendKey(), comma(), endArray(), endMap(), startArray(), and startMap().
|
private |
Definition at line 115 of file jsonstreamwriter.h.
Referenced by appendKey(), appendValue(), appendValue(), endArray(), endMap(), startArray(), and startMap().