SNode.C
Loading...
Searching...
No Matches
StringRaw.cpp
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#include "iot/mqtt/types/StringRaw.h"
21
22#include "iot/mqtt/types/TypeBase.hpp"
23
24#ifndef DOXYGEN_SHOULD_SKIP_THIS
25
26#include <vector>
27
28#endif // DOXYGEN_SHOULD_SKIP_THIS
29
30namespace iot::mqtt::types {
31
33 : TypeBase(0) {
34 }
35
37 }
38
39 StringRaw& StringRaw::operator=(const std::string& newValue) {
40 value = std::vector<char>(newValue.begin(), newValue.end());
41 return *this;
42 }
43
44 StringRaw::operator std::string() const {
45 return std::string(value.begin(), value.end());
46 }
47
48 bool StringRaw::operator==(const std::string& rhsValue) const {
49 return static_cast<std::string>(*this) == rhsValue;
50 }
51
52 bool StringRaw::operator!=(const std::string& rhsValue) const {
53 return static_cast<std::string>(*this) != rhsValue;
54 }
55
56 void StringRaw::reset([[maybe_unused]] std::size_t size) {
57 TypeBase::reset(0);
58 }
59
60} // namespace iot::mqtt::types
void reset(std::size_t size=0) override
Definition StringRaw.cpp:56
bool operator!=(const std::string &rhsValue) const
Definition StringRaw.cpp:52
operator std::string() const
Definition StringRaw.cpp:44
StringRaw & operator=(const std::string &newValue)
Definition StringRaw.cpp:39
bool operator==(const std::string &rhsValue) const
Definition StringRaw.cpp:48