Loading...
Searching...
No Matches
cborstreamreaderinterface.h
Go to the documentation of this file.
/**
* \file pappsomspp/processing/cbor/cborstreamreaderinterface.h
* \date 11/02/2025
* \author Olivier Langella
* \brief common interface to read CBOR streams with convenient framework
*/
/*******************************************************************************
* Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include <QCborStreamReader>
#include <QFile>
#include "pappsomspp/export-import-config.h"
#include "cborstreamreader.h"
namespace pappso::cbor
{
/**
* @brief base class to start a CBOR reader
*
* containing convenient function to ensure that the stream pointer to the CBOR
* source (file or device) is correctly open.
*/
class PMSPP_LIB_DECL CborStreamReaderInterface
{
public:
/**
* Default constructor
*/
CborStreamReaderInterface();
/**
* Destructor
*/
virtual ~CborStreamReaderInterface();
/** @brief convenient function to clean pointer before leaving
*
*/
virtual void close();
protected:
bool getExpectedString();
void initCborReader(QFile *pcborfile);
void initCborReader(QIODevice *pcborfile);
protected:
CborStreamReader *mpa_cborReader = nullptr;
QString m_expectedString;
QByteArray m_data;
};
} // namespace pappso::cbor
cborstreamreader.h
pappso::cbor::CborStreamReaderInterface::close
virtual void close()
convenient function to clean pointer before leaving
Definition cborstreamreaderinterface.cpp:44
pappso::cbor::CborStreamReaderInterface::CborStreamReaderInterface
CborStreamReaderInterface()
Definition cborstreamreaderinterface.cpp:30
pappso::cbor::CborStreamReaderInterface::m_expectedString
QString m_expectedString
Definition cborstreamreaderinterface.h:69
pappso::cbor::CborStreamReaderInterface::initCborReader
void initCborReader(QFile *pcborfile)
Definition cborstreamreaderinterface.cpp:80
pappso::cbor::CborStreamReaderInterface::getExpectedString
bool getExpectedString()
Definition cborstreamreaderinterface.cpp:54
pappso::cbor::CborStreamReaderInterface::mpa_cborReader
CborStreamReader * mpa_cborReader
Definition cborstreamreaderinterface.h:68
pappso::cbor::CborStreamReaderInterface::m_data
QByteArray m_data
Definition cborstreamreaderinterface.h:70
pappso::cbor::CborStreamReader
simple override of the raw QCborStreamReader This adds convenient functions to put CBOR data into C++...
Definition cborstreamreader.h:46
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::cbor
Definition cborstreamreader.cpp:35