#pragma once
#include <string>
#include "field.h"
namespace refl {
	struct AnyArgs {
		void* data;
		int num;
		int size;
		bool isMemoryOwner{false};
		AnyArgs(const sarray<Any>& args,const sarray<const UClass*>& params,void* memory = nullptr);
		~AnyArgs();
		int Size();
		const sarray<Any> ToSArray();
		constexpr static Offset GetArgsSize(const sarray<Any>& args, const sarray<const UClass*>& params);
		template<typename...Args>
		consteval static Offset GetArgsSize(const sarray<Any>& args);
	};
	class AnyView : public Any{
	public:
		const FieldPtr* cache{ nullptr };
		AnyView(const void* ptr, const UClass* cls) : Any(ptr,cls) {}
	public:

		template<typename T>
		bool Get(const Name& name, T& t);

		template<typename T>
		bool Set(const Name& name, const T& t);

		bool Invoke(const Name& name,const sarray<Any>& ArgsList);

		bool Invoke(const Name& name,svector<Any>& ArgsList);

		bool Invokes(const Name& name, const sarray<Any>& ArgsList);
		bool Invokes(const Name& name, svector<Any>& ArgsList);
		AnyView Parent();
	};
}