libpappsomspp
Library for mass spectrometry
cborstreamreader.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/cborstreamwriter.h
3 * \date 08/07/2025
4 * \author Olivier Langella
5 * \brief PAPPSO CBOR stream reader
6 *
7 * QCborStreamReader overloaded with convenient functions
8 */
9
10/*******************************************************************************
11 * Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
12 *
13 * This file is part of PAPPSOms-tools.
14 *
15 * PAPPSOms-tools is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * PAPPSOms-tools is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
27 *
28 ******************************************************************************/
29#pragma once
30
31#include <QCborStreamReader>
32#include <QStringList>
33#include <QCborMap>
34#include <QCborArray>
35
36namespace pappso::cbor
37{
38/**
39 * @todo write docs
40 */
41class CborStreamReader : public QCborStreamReader
42{
43 public:
44 /**
45 * Default constructor
46 */
48 CborStreamReader(QIODevice *device);
49
50 /**
51 * Destructor
52 */
53 virtual ~CborStreamReader();
54
55 /** @brief decode the current cbor value as a string the point to the next value
56 * the current value is decoded as a string, beware that using this function, the cbor stream will
57 * point to the next cbor value
58 * @return true if OK
59 */
60 bool decodeString(QString &the_str);
61
62 bool readCborMap(QCborMap &cbor_map);
63 bool readCborArray(QCborArray &cbor_array);
64 bool readArray(std::vector<std::size_t> &int_list);
65 bool readArray(std::vector<double> &double_list);
66 bool readArray(std::vector<int> &positions);
67 bool readArray(QStringList &str_list);
68};
69} // namespace pappso::cbor
bool readCborMap(QCborMap &cbor_map)
bool readCborArray(QCborArray &cbor_array)
bool readArray(std::vector< std::size_t > &int_list)
bool decodeString(QString &the_str)
decode the current cbor value as a string the point to the next value the current value is decoded as...