wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
entity_reflect.hpp File Reference

The reflection helpers every format engine shares: reading a member's annotations, gating it by the entity's client version, and enumerating an entity's members with its public bases flattened in (how conditionally inherited version-trait bases stay invisible to the engines). More...

#include <meta>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string_view>
#include <vector>
#include <wowlib/core/client_version.hpp>
#include <wowlib/formats/common/annotations.hpp>
Include dependency graph for entity_reflect.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  wowlib
namespace  wowlib::formats
namespace  wowlib::formats::detail

Functions

template<typename Spec, std::meta::info M>
consteval std::optional< Spec > wowlib::formats::detail::annotation ()
 The first annotation of type Spec on reflected member M, if any.
template<ClientVersion V, std::meta::info M>
consteval bool wowlib::formats::detail::versionActive ()
 Whether member M participates for entity version V, per its since/until annotations (absent bounds mean unbounded).
consteval void wowlib::formats::detail::collectMembers (std::meta::info type, std::vector< std::meta::info > &out)
 Collect type's non-static data members with its public bases flattened in FIRST (recursively, declaration order) — mirroring how welder flattens a non-welded base's members into the derived binding.
template<typename E>
consteval auto wowlib::formats::detail::membersOf ()
 The reflected member list of E, public bases flattened in (see collectMembers).
template<typename E>
consteval std::meta::info wowlib::formats::detail::memberNamed (std::string_view name)
 The reflected member of E named name (public bases flattened, like membersOf), or the null reflection when no member carries the name — how the sibling-naming annotations (countMatches, indexes, offsetAfter) resolve their target at compile time, so a typo is a static_assert at the use site rather than a silent no-op.
consteval bool wowlib::formats::detail::nestedInStd (std::meta::info r)
 Whether r is declared inside namespace std (at any nesting depth — libstdc++ hides types in inline namespaces like std::__cxx11).
template<typename T>
consteval bool wowlib::formats::detail::isStdType ()
 Whether T is a standard-library type (see nestedInStd).

Variables

template<typename T>
constexpr bool wowlib::formats::detail::IsVectorV = false
 Trait: is T a std::vector (an array-chunk member)?
template<typename U, typename A>
constexpr bool wowlib::formats::detail::IsVectorV< std::vector< U, A > > = true

Detailed Description

The reflection helpers every format engine shares: reading a member's annotations, gating it by the entity's client version, and enumerating an entity's members with its public bases flattened in (how conditionally inherited version-trait bases stay invisible to the engines).

These live apart from any one engine because all three read them — the chunk serializer (chunked_file.hpp), the M2 offset serializer (m2/offset_block.hpp) and the validation walker (validation.hpp). They keep the wowlib::formats::detail namespace they have always had, so call sites are unaffected by where they are declared.

Definition in file entity_reflect.hpp.