libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
jsonstreamwriter.h
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/cbor/jsonstreamwriter.h
3
* \date 19/07/2025
4
* \author Olivier Langella
5
* \brief PAPPSO JSON stream writer
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
10
*
11
* This file is part of PAPPSOms-tools.
12
*
13
* PAPPSOms-tools is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
17
*
18
* PAPPSOms-tools is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
25
*
26
******************************************************************************/
27
#pragma once
28
29
#include <QTextStream>
30
#include <QCborMap>
31
#include <QCborArray>
32
#include <QIODevice>
33
namespace
pappso::cbor
34
{
35
/**
36
* @todo write docs
37
*/
38
class
JsonStreamWriter
:
public
QTextStream
39
{
40
public
:
41
/**
42
* Default constructor
43
*/
44
JsonStreamWriter
(QIODevice *device);
45
46
/**
47
* Destructor
48
*/
49
virtual
~JsonStreamWriter
();
50
51
void
startArray
();
52
void
endArray
();
53
void
startMap
();
54
void
endMap
();
55
56
57
void
writeCborMap
(
const
QCborMap &cbor_map);
58
void
writeCborArray
(
const
QCborArray &cbor_array);
59
void
appendKey
(
const
QString &key);
60
void
appendValue
(
const
QString &value);
61
void
writeArray
(QStringList &str_list);
62
63
protected
:
64
void
comma
();
65
66
private
:
67
bool
m_isStart
=
true
;
68
bool
m_nextIsValue
=
false
;
69
};
70
}
// namespace pappso::cbor
pappso::cbor::JsonStreamWriter
Definition
jsonstreamwriter.h:39
pappso::cbor::JsonStreamWriter::comma
void comma()
Definition
jsonstreamwriter.cpp:118
pappso::cbor::JsonStreamWriter::appendValue
void appendValue(const QString &value)
Definition
jsonstreamwriter.cpp:105
pappso::cbor::JsonStreamWriter::endArray
void endArray()
Definition
jsonstreamwriter.cpp:43
pappso::cbor::JsonStreamWriter::m_nextIsValue
bool m_nextIsValue
Definition
jsonstreamwriter.h:68
pappso::cbor::JsonStreamWriter::endMap
void endMap()
Definition
jsonstreamwriter.cpp:51
pappso::cbor::JsonStreamWriter::writeCborArray
void writeCborArray(const QCborArray &cbor_array)
Definition
jsonstreamwriter.cpp:85
pappso::cbor::JsonStreamWriter::m_isStart
bool m_isStart
Definition
jsonstreamwriter.h:67
pappso::cbor::JsonStreamWriter::startMap
void startMap()
Definition
jsonstreamwriter.cpp:67
pappso::cbor::JsonStreamWriter::writeArray
void writeArray(QStringList &str_list)
Definition
jsonstreamwriter.cpp:112
pappso::cbor::JsonStreamWriter::appendKey
void appendKey(const QString &key)
Definition
jsonstreamwriter.cpp:95
pappso::cbor::JsonStreamWriter::~JsonStreamWriter
virtual ~JsonStreamWriter()
Definition
jsonstreamwriter.cpp:38
pappso::cbor::JsonStreamWriter::writeCborMap
void writeCborMap(const QCborMap &cbor_map)
Definition
jsonstreamwriter.cpp:76
pappso::cbor::JsonStreamWriter::startArray
void startArray()
Definition
jsonstreamwriter.cpp:59
pappso::cbor
Definition
cborstreamreader.cpp:35
pappsomspp
core
processing
cbor
jsonstreamwriter.h
Generated on Thu Nov 6 2025 12:27:26 for libpappsomspp by
1.9.8