Files
reflect-cpp/include/rfl/flexbuf/OutputNull.hpp
T

39 lines
693 B
C++

#ifndef FLEXBUF_OUTPUTNULL_HPP_
#define FLEXBUF_OUTPUTNULL_HPP_
#include <flatbuffers/flexbuffers.h>
#include <optional>
#include <string>
#include "../Ref.hpp"
#include "OutputVar.hpp"
namespace rfl {
namespace flexbuf {
class OutputNull : public OutputVar {
public:
OutputNull() {}
~OutputNull() = default;
/// Inserts all elements into the builder.
void insert(const std::optional<std::string>& _key,
flexbuffers::Builder* _fbb) final {
if (_key) {
_fbb->Null(_key->c_str());
} else {
_fbb->Null();
}
}
/// Whether this is null.
bool is_null() const final { return true; }
};
} // namespace flexbuf
} // namespace rfl
#endif