SNode.C
Loading...
Searching...
No Matches
BinaryData.h
Go to the documentation of this file.
1/*
2 * SNode.C - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef IOT_MQTT_TYPES_BINARYDATA_H
21#define IOT_MQTT_TYPES_BINARYDATA_H
22
23#include "iot/mqtt/types/TypeBase.h"
24#include "iot/mqtt/types/UInt16.h"
25
26namespace iot::mqtt {
27 class MqttContext;
28}
29
30#ifndef DOXYGEN_SHOULD_SKIP_THIS
31
32#include <cstddef>
33#include <vector>
34
35#endif // DOXYGEN_SHOULD_SKIP_THIS
36
37namespace iot::mqtt::types {
38
39 class BinaryData : public TypeBase<std::vector<char>> {
40 public:
41 BinaryData();
42 BinaryData(const BinaryData&) = default;
43 BinaryData(BinaryData&&) noexcept = default;
44
46
47 BinaryData& operator=(const BinaryData&) = default;
48 BinaryData& operator=(BinaryData&&) noexcept = default;
49
50 std::size_t deserialize(iot::mqtt::MqttContext* mqttContext) override;
51 std::vector<char> serialize() const override;
52
53 BinaryData& operator=(const std::vector<char>& newValue);
54 operator std::vector<char>() const;
55
56 bool operator==(const std::vector<char>& rhsValue) const;
57 bool operator!=(const std::vector<char>& rhsValue) const;
58
59 void reset(std::size_t size = 0) override;
60
61 private:
63 };
64
65 extern template class TypeBase<std::vector<char>>;
66
67} // namespace iot::mqtt::types
68
69#endif // IOT_MQTT_TYPES_BINARYDATA_H
BinaryData(const BinaryData &)=default
bool operator==(const std::vector< char > &rhsValue) const
std::size_t deserialize(iot::mqtt::MqttContext *mqttContext) override
BinaryData & operator=(BinaryData &&) noexcept=default
void reset(std::size_t size=0) override
BinaryData & operator=(const std::vector< char > &newValue)
bool operator!=(const std::vector< char > &rhsValue) const
BinaryData(BinaryData &&) noexcept=default
std::vector< char > serialize() const override
BinaryData & operator=(const BinaryData &)=default