3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/platform/Result.h"
15enum class SnbtFormat : uint {
17 CompoundLineFeed = 1 << 0,
18 ArrayLineFeed = 1 << 1,
23 CommentMarks = 1 << 6,
24 Jsonify = ForceQuote | CommentMarks,
25 PartialLineFeed = CompoundLineFeed,
26 AlwaysLineFeed = CompoundLineFeed | ArrayLineFeed,
27 PrettyFilePrint = PartialLineFeed,
28 PrettyChatPrint = PrettyFilePrint | Colored,
29 PrettyConsolePrint = PrettyFilePrint | Colored | Console,
31[[nodiscard]]
constexpr SnbtFormat operator|(
const SnbtFormat l,
const SnbtFormat r)
noexcept {
32 return static_cast<SnbtFormat
>(
33 static_cast<std::underlying_type_t<SnbtFormat>
>(l) |
static_cast<std::underlying_type_t<SnbtFormat>
>(r)
36[[nodiscard]]
constexpr SnbtFormat operator&(
const SnbtFormat l,
const SnbtFormat r)
noexcept {
37 return static_cast<SnbtFormat
>(
38 static_cast<std::underlying_type_t<SnbtFormat>
>(l) &
static_cast<std::underlying_type_t<SnbtFormat>
>(r)
44 constexpr Tag() =
default;
48 enum class Type : uchar {
64 template <std::derived_from<Tag> T>
65 T
const* as_ptr()
const {
66 return static_cast<T const*
>(
this);
68 template <std::derived_from<Tag> T>
70 return static_cast<T*
>(
this);
72 template <std::derived_from<Tag> T>
74 return *
static_cast<T const*
>(
this);
76 template <std::derived_from<Tag> T>
78 return *
static_cast<T*
>(
this);
81 [[nodiscard]]
bool operator==(Tag
const& other)
const {
return equals(other); }
83 LLNDAPI std::string toSnbt(SnbtFormat snbtFormat = SnbtFormat::PrettyFilePrint, uchar indent = 4)
const noexcept;
88 virtual ~Tag() =
default;
90 virtual void deleteChildren();
96 virtual ::std::string toString()
const = 0;
98 virtual ::Tag::Type getId()
const = 0;
100 virtual bool equals(::Tag
const& rhs)
const;
104 virtual void print(::std::string
const& prefix,
::PrintStream& out)
const;
106 virtual ::std::unique_ptr<::Tag> copy()
const = 0;
108 virtual uint64 hash()
const = 0;
114 MCAPI static ::std::string getTagName(::Tag::Type type);
116 MCAPI static ::Bedrock::Result<::std::unique_ptr<::Tag>> newTag(::Tag::Type type);
122 MCAPI static ::std::string
const& NullString();
134 MCFOLD
void $deleteChildren();
136 MCFOLD
bool $equals(::Tag
const& rhs)
const;
140 MCAPI
void $print(::std::string
const& prefix,
::PrintStream& out)
const;
Definition IDataOutput.h:5
Definition PrintStream.h:5
static MCAPI void ** $vftable()