LeviLamina
Loading...
Searching...
No Matches
CompoundTag.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/nbt/Tag.h"
7#include "mc/platform/Result.h"
8
9#include "ll/api/Expected.h"
10
12
13class CompoundTag : public ::Tag {
14public:
15 using TagMap = std::map<std::string, CompoundTagVariant, std::less<void>>;
16
17 TagMap mTags;
18
19 using iterator = TagMap::iterator;
20 using const_iterator = TagMap::const_iterator;
21 using reverse_iterator = TagMap::reverse_iterator;
22 using const_reverse_iterator = TagMap::const_reverse_iterator;
23
24 CompoundTag() = default;
25
26 CompoundTag(TagMap tags) : mTags(std::move(tags)) {}
27
28 CompoundTag(std::initializer_list<TagMap::value_type> tagPairs) : mTags(tagPairs) {}
29
30 CompoundTag(CompoundTag const&) = default;
31 CompoundTag& operator=(CompoundTag const&) = default;
32 CompoundTag(CompoundTag&&) = default;
33 CompoundTag& operator=(CompoundTag&&) = default;
34
35 [[nodiscard]] CompoundTagVariant& operator[](std::string_view index);
36 [[nodiscard]] CompoundTagVariant const& operator[](std::string_view index) const;
37
38 [[nodiscard]] CompoundTagVariant& at(std::string_view index) { return operator[](index); }
39 [[nodiscard]] CompoundTagVariant const& at(std::string_view index) const { return operator[](index); }
40
41 LLNDAPI static ll::Expected<CompoundTag>
42 fromSnbt(std::string_view snbt, optional_ref<size_t> parsedLength = std::nullopt) noexcept;
43
44 LLNDAPI std::string toBinaryNbt(bool isLittleEndian = true) const;
45 LLNDAPI static ll::Expected<CompoundTag>
46 fromBinaryNbt(std::string_view dataView, bool isLittleEndian = true) noexcept;
47
48 LLNDAPI std::string toNetworkNbt() const;
49 LLNDAPI static ll::Expected<CompoundTag> fromNetworkNbt(std::string const& data) noexcept;
50
51 [[nodiscard]] size_t size() const noexcept { return mTags.size(); }
52 [[nodiscard]] bool empty() const noexcept { return mTags.empty(); }
53
54 [[nodiscard]] auto begin() noexcept;
55 [[nodiscard]] auto begin() const noexcept;
56 [[nodiscard]] auto end() noexcept;
57 [[nodiscard]] auto end() const noexcept;
58 [[nodiscard]] auto rbegin() noexcept;
59 [[nodiscard]] auto rbegin() const noexcept;
60 [[nodiscard]] auto rend() noexcept;
61 [[nodiscard]] auto rend() const noexcept;
62 [[nodiscard]] auto cbegin() const noexcept;
63 [[nodiscard]] auto cend() const noexcept;
64 [[nodiscard]] auto crbegin() const noexcept;
65 [[nodiscard]] auto crend() const noexcept;
66
67 bool erase(std::string_view name);
68 void rename(std::string_view name, std::string_view newName);
69
70public:
71 // virtual functions
72 // NOLINTBEGIN
73 // vIndex: 0
74 virtual ~CompoundTag() /*override*/ = default;
75
76 // vIndex: 2
77 virtual void write(::IDataOutput& dos) const /*override*/;
78
79 // vIndex: 3
80 virtual ::Bedrock::Result<void> load(::IDataInput& dis) /*override*/;
81
82 // vIndex: 5
83 virtual ::Tag::Type getId() const /*override*/;
84
85 // vIndex: 4
86 virtual ::std::string toString() const /*override*/;
87
88 // vIndex: 7
89 virtual void print(::std::string const& prefix, ::PrintStream& out) const /*override*/;
90
91 // vIndex: 9
92 virtual ::std::unique_ptr<::Tag> copy() const /*override*/;
93
94 // vIndex: 10
95 virtual uint64 hash() const /*override*/;
96
97 // vIndex: 6
98 virtual bool equals(::Tag const& obj) const /*override*/;
99 // NOLINTEND
100
101public:
102 // member functions
103 // NOLINTBEGIN
104
105 MCAPI void append(::CompoundTag const& tag);
106
107 MCAPI ::std::unique_ptr<::CompoundTag> clone() const;
108
109 MCAPI bool contains(::std::string_view name) const;
110
111 MCAPI bool contains(::std::string_view name, ::Tag::Type type) const;
112 // NOLINTEND
113
114public:
115 // constructor thunks
116 // NOLINTBEGIN
117 MCAPI void* $ctor();
118
119 MCAPI void* $ctor(::CompoundTag&& rhs);
120 // NOLINTEND
121
122public:
123 // destructor thunk
124 // NOLINTBEGIN
125 MCFOLD void $dtor();
126 // NOLINTEND
127
128public:
129 // virtual function thunks
130 // NOLINTBEGIN
131 MCAPI void $write(::IDataOutput& dos) const;
132
133 MCAPI ::Bedrock::Result<void> $load(::IDataInput& dis);
134
135 MCAPI ::Tag::Type $getId() const;
136
137 MCAPI ::std::string $toString() const;
138
139 MCAPI void $print(::std::string const& prefix, ::PrintStream& out) const;
140
141 MCAPI ::std::unique_ptr<::Tag> $copy() const;
142
143 MCAPI uint64 $hash() const;
144
145 MCAPI bool $equals(::Tag const& obj) const;
146 // NOLINTEND
147
148public:
149 // vftables
150 // NOLINTBEGIN
151 MCAPI static void** $vftable();
152 // NOLINTEND
153};
154
155#include "mc/nbt/CompoundTagVariant.h"
Definition CompoundTagVariant.h:38
Definition CompoundTag.h:13
Definition IDataInput.h:8
Definition IDataOutput.h:5
Definition PrintStream.h:5
Definition Tag.h:39
Definition optional_ref.h:10