Make sure that the headers are self-contained; fixes #528 (#531)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-10-25 13:03:12 +02:00
committed by GitHub
parent 72a721404f
commit d0f60b214f
59 changed files with 272 additions and 227 deletions
+4 -3
View File
@@ -5,14 +5,15 @@
#include <cstddef>
#include <exception>
#include <optional>
#include <string>
#include <string_view>
//#include "../Bytestring.hpp"
#include "../Bytestring.hpp"
#include "../Result.hpp"
//#include "../Vectorstring.hpp"
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
//#include "../internal/ptr_cast.hpp"
#include "../internal/ptr_cast.hpp"
namespace rfl {
namespace msgpack {
+14 -14
View File
@@ -3,14 +3,13 @@
#include <msgpack.h>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <type_traits>
//#include "../Box.hpp"
#include "../Bytestring.hpp"
//#include "../Ref.hpp"
//#include "../Result.hpp"
#include "../Vectorstring.hpp"
#include "../always_false.hpp"
#include "../common.hpp"
@@ -47,27 +46,27 @@ class RFL_API Writer {
OutputArrayType add_array_to_array(const size_t _size,
OutputArrayType* _parent) const noexcept;
OutputArrayType add_array_to_object(
const std::string_view& _name, const size_t _size,
OutputObjectType* _parent) const noexcept;
OutputArrayType add_array_to_object(const std::string_view& _name,
const size_t _size,
OutputObjectType* _parent) const noexcept;
OutputObjectType add_object_to_array(
const size_t _size, OutputArrayType* _parent) const noexcept;
OutputObjectType add_object_to_array(const size_t _size,
OutputArrayType* _parent) const noexcept;
OutputObjectType add_object_to_object(
const std::string_view& _name, const size_t _size,
OutputObjectType* _parent) const noexcept;
template <class T>
OutputVarType add_value_to_array(const T& _var,
OutputArrayType* /*_parent*/) const noexcept {
OutputVarType add_value_to_array(
const T& _var, OutputArrayType* /*_parent*/) const noexcept {
return new_value(_var);
}
template <class T>
OutputVarType add_value_to_object(const std::string_view& _name,
const T& _var,
OutputObjectType* /*_parent*/) const noexcept {
OutputVarType add_value_to_object(
const std::string_view& _name, const T& _var,
OutputObjectType* /*_parent*/) const noexcept {
msgpack_pack_str(pk_, _name.size());
msgpack_pack_str_body(pk_, _name.data(), _name.size());
return new_value(_var);
@@ -93,7 +92,8 @@ class RFL_API Writer {
if constexpr (std::is_same<Type, std::string>()) {
msgpack_pack_str(pk_, _var.size());
msgpack_pack_str_body(pk_, _var.c_str(), _var.size());
} else if constexpr (std::is_same<Type, rfl::Bytestring>() || std::is_same<Type, rfl::Vectorstring>()) {
} else if constexpr (std::is_same<Type, rfl::Bytestring>() ||
std::is_same<Type, rfl::Vectorstring>()) {
msgpack_pack_bin(pk_, _var.size());
msgpack_pack_bin_body(pk_, _var.data(), _var.size());
} else if constexpr (std::is_same<Type, bool>()) {