9#include <Pt/Reflex/MethodInfo.h>
10#include <Pt/Reflex/PropertyInfo.h>
11#include <Pt/Reflex/ConstructorInfo.h>
12#include <Pt/Reflex/Argument.h>
51 virtual Pt::Reflex::Type*
rtype()
const = 0;
56 {
return ! _errorMsg.empty(); }
68 Call& operator=(
const Call&) =
delete;
76 std::string _errorMsg;
90 std::vector<Pt::Reflex::Argument> args)
100 Pt::Reflex::ArgumentList arglist(
101 _args.empty() ?
static_cast<Pt::Reflex::Argument*
>(0) : &_args[0],
103 return _mi->call(_self, arglist);
105 catch(
const std::exception& e) {
setError(e.what()); }
110 Pt::Reflex::Type*
rtype()
const override
111 {
return &_mi->rtype(); }
114 Pt::Reflex::MethodInfo* _mi;
116 std::vector<Pt::Reflex::Argument> _args;
136 try {
return _pi->get(_self); }
137 catch(
const std::exception& e) {
setError(e.what()); }
142 Pt::Reflex::Type*
rtype()
const override
143 {
return &_pi->type(); }
146 Pt::Reflex::PropertyInfo* _pi;
161 Pt::Reflex::Argument value)
169 try { _pi->set(_self, _value.toAny(), _value.type()); }
170 catch(
const std::exception& e) {
setError(e.what()); }
175 Pt::Reflex::Type*
rtype()
const override
179 Pt::Reflex::PropertyInfo* _pi;
181 Pt::Reflex::Argument _value;
195 std::vector<Pt::Reflex::Argument> args)
197 , _instance(instance)
205 Pt::Reflex::ArgumentList arglist(
206 _args.empty() ?
static_cast<Pt::Reflex::Argument*
>(0) : &_args[0],
208 _ci->call(_instance, arglist);
210 catch(
const std::exception& e) {
setError(e.what()); }
215 Pt::Reflex::Type*
rtype()
const override
219 Pt::Reflex::ConstructorInfo* _ci;
221 std::vector<Pt::Reflex::Argument> _args;
Value of any copyable type.
Definition Any.h:79
Synchronous native call from Lua.
Definition Call.h:38
virtual Pt::Reflex::Type * rtype() const =0
Returns the Reflex result type, or a null pointer.
virtual ~Call()
Destroys the call.
Definition Call.h:42
const std::string & errorMessage() const
Returns the stored error text.
Definition Call.h:60
void setError(const std::string &msg)
Stores msg as the error of this call.
Definition Call.h:72
virtual Pt::Any call()=0
Performs the invocation and returns the result.
bool hasError() const
Returns true when the invocation stored an error.
Definition Call.h:55
ConstructorCall(Pt::Reflex::ConstructorInfo *ci, void *instance, std::vector< Pt::Reflex::Argument > args)
Creates a construction of instance with ci and args.
Definition Call.h:194
Pt::Reflex::Type * rtype() const override
Returns the Reflex result type, or a null pointer.
Definition Call.h:215
Pt::Any call() override
Performs the invocation and returns the result.
Definition Call.h:201
Pt::Reflex::Type * rtype() const override
Returns the Reflex result type, or a null pointer.
Definition Call.h:110
MethodCall(Pt::Reflex::MethodInfo *mi, void *self, std::vector< Pt::Reflex::Argument > args)
Creates a call of mi on self with args.
Definition Call.h:89
Pt::Any call() override
Performs the invocation and returns the result.
Definition Call.h:96
Pt::Reflex::Type * rtype() const override
Returns the Reflex result type, or a null pointer.
Definition Call.h:142
PropertyGetCall(Pt::Reflex::PropertyInfo *pi, void *self)
Creates a read of pi on self.
Definition Call.h:129
Pt::Any call() override
Performs the invocation and returns the result.
Definition Call.h:134
Pt::Reflex::Type * rtype() const override
Returns the Reflex result type, or a null pointer.
Definition Call.h:175
PropertySetCall(Pt::Reflex::PropertyInfo *pi, void *self, Pt::Reflex::Argument value)
Creates a write of value to pi on self.
Definition Call.h:160
Pt::Any call() override
Performs the invocation and returns the result.
Definition Call.h:167
Lua runtime and reflected bindings.
Core module.
Definition Allocator.h:33