zengine-old/engine/3rdparty/zlib/include/refl/detail/view.h

36 lines
950 B
C
Raw Normal View History

2024-04-07 21:15:34 +08:00
#pragma once
2024-04-06 23:50:17 +08:00
#include <string>
2024-04-16 16:17:13 +08:00
#include "field.h"
2024-04-06 23:50:17 +08:00
namespace refl {
2024-04-25 21:45:41 +08:00
struct AnyArgs {
2024-04-14 22:45:08 +08:00
void* data;
2024-04-15 19:53:39 +08:00
int num;
2024-04-25 21:45:41 +08:00
int size;
2024-04-14 22:45:08 +08:00
bool isMemoryOwner{false};
2024-04-25 21:45:41 +08:00
AnyArgs(const sarray<Any>& args,const sarray<const UClass*>& params,void* memory = nullptr);
~AnyArgs();
int Size();
2024-04-19 22:02:27 +08:00
const sarray<Any> ToSArray();
2024-04-25 21:45:41 +08:00
constexpr static Offset GetArgsSize(const sarray<Any>& args, const sarray<const UClass*>& params);
2024-04-09 16:31:09 +08:00
};
2024-04-19 22:02:27 +08:00
class AnyView : public Any{
2024-04-11 10:13:15 +08:00
public:
const FieldPtr* cache{ nullptr };
2024-04-19 22:02:27 +08:00
AnyView(const void* ptr, const UClass* cls) : Any(ptr,cls) {}
2024-04-11 10:13:15 +08:00
public:
template<typename T>
bool Get(const Name& name, T& t);
template<typename T>
bool Set(const Name& name, const T& t);
2024-04-19 22:02:27 +08:00
bool Invoke(const Name& name,const sarray<Any>& ArgsList);
2024-04-11 10:13:15 +08:00
2024-04-19 22:02:27 +08:00
bool Invoke(const Name& name,svector<Any>& ArgsList);
2024-04-11 10:13:15 +08:00
2024-06-12 22:07:45 +08:00
bool Invokes(const Name& name, const sarray<Any>& ArgsList);
bool Invokes(const Name& name, svector<Any>& ArgsList);
2024-04-19 22:02:27 +08:00
AnyView Parent();
2024-04-11 10:13:15 +08:00
};
2024-04-06 23:50:17 +08:00
}