libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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>
36
37namespace pappso
38{
39namespace cbor
40{
41/**
42 * @brief simple override of the raw QCborStreamReader
43 * This adds convenient functions to put CBOR data into C++ structures
44 */
45class PMSPP_LIB_DECL CborStreamReader : public QCborStreamReader
46{
47 public:
48 /**
49 * Default constructor
50 */
52 CborStreamReader(QIODevice *device);
53
54 /**
55 * Destructor
56 */
57 virtual ~CborStreamReader();
58
59 /** @brief decode the current cbor value as a string the point to the next value
60 * the current value is decoded as a string, beware that using this function, the cbor stream will
61 * point to the next cbor value
62 * @param the_str reference to the string
63 * @return true if OK
64 */
65 bool decodeString(QString &the_str);
66
67 /** @brief transfer the entire current CBOR map to a QCborMap object
68 * @param cbor_map QCborMap reference to use
69 * @return true if OK
70 */
71 bool readCborMap(QCborMap &cbor_map);
72
73
74 /** @brief transfer the entire current CBOR array to a QCborMap object
75 * @param cbor_map QCborMap reference to use
76 * @return true if OK
77 */
78 bool readCborArray(QCborArray &cbor_array);
79 bool readArray(std::vector<std::size_t> &int_list);
80 bool readArray(std::vector<qint64> &int_list);
81 bool readArray(std::vector<double> &double_list);
82 bool readArray(std::vector<int> &positions);
83 bool readArray(std::vector<std::uint8_t> &small_int_list);
84 bool readArray(QStringList &str_list);
85 bool readArray(std::vector<QString> &str_list);
86};
87} // namespace cbor
88} // namespace pappso
bool readCborMap(QCborMap &cbor_map)
transfer the entire current CBOR map to a QCborMap object
bool readCborArray(QCborArray &cbor_array)
transfer the entire current CBOR array to a QCborMap object
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...
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39