xca/lib/BioByteArray.h
Christian Hohnstaedt 993da2d474 Use C++11 initializers for all non-static class members
When XCA started in 2002, there were no C++ initializers.
Drop explicit initializers from the constructors.

 - Fix indentations of section declarators.
 - Replace NULL by nullptr when feasible.
 - Sort private section: properties first, then methods.
2023-10-08 22:19:18 +02:00

45 lines
993 B
C++

/* vi: set sw=4 ts=4:
*
* Copyright (C) 2020 Christian Hohnstaedt.
*
* All rights reserved.
*/
#ifndef __BIOBYTEARRAY_H
#define __BIOBYTEARRAY_H
#include <QByteArray>
#include <QString>
#include <openssl/bio.h>
class BioByteArray
{
protected:
BIO *read_write{};
BIO *read_only{};
QByteArray store{};
void set(const QByteArray &qba);
void add(const QByteArray &qba);
void biowrite(const QByteArray &qba);
void cleanse_and_free(BIO *bio);
public:
BioByteArray(const QByteArray &qba) : store(qba) { }
BioByteArray(const BioByteArray &bba) : store(bba.byteArray()) { }
BioByteArray() { }
~BioByteArray();
int size() const;
BIO *bio();
BIO *ro();
QByteArray byteArray() const;
QString qstring() const;
operator BIO*();
operator QByteArray();
BioByteArray &operator = (const BioByteArray &other);
BioByteArray &operator = (const QByteArray &qba);
BioByteArray &operator += (const BioByteArray &other);
BioByteArray &operator += (const QByteArray &qba);
};
#endif