![]() |
Gorgon Game Engine
|
This class allows mapping of a data member to c++ function data member. More...
Public Member Functions | |
| template<class F1_ , class F2_ > | |
| MappedInstanceMember_Function (F1_ reader, F2_ writer, const std::string &name, const std::string &help, const Type *type, const Type *parent, bool isconstfn, bool isreffn, bool ref, bool isgetconst, bool issetconst=false) | |
| Constructs a new MappedInstanceMember_Function. More... | |
Public Member Functions inherited from MappedROInstanceMember_Function | |
| template<class F_ > | |
| MappedROInstanceMember_Function (F_ reader, const std::string &name, const std::string &help, const Type *type, const Type *parent, bool isconstfn, bool isreffn, bool constant=false) | |
| Constructs a new MappedROInstanceMember_Function. More... | |
| virtual | ~MappedROInstanceMember_Function () |
Public Member Functions inherited from InstanceMember | |
| InstanceMember (const std::string &name, const std::string &help, const Type &type, bool constant=false, bool ref=false, bool readonly=false) | |
| Constructor. More... | |
| virtual | ~InstanceMember () |
| Data | Get (Data &source) const |
| Gets data from the datamember. More... | |
| const Type & | GetType () const |
| Returns the type of this data member. More... | |
| bool | IsConstant () const |
| Returns whether this member is a constant. More... | |
| virtual bool | IsInstanceMember () const override final |
| Returns if this member is an instance member. More... | |
| bool | IsReadonly () const |
| Returns whether this member is read-only. More... | |
| bool | IsReference () const |
| Returns whether this member is a reference. More... | |
| void | Set (Data &source, Data &value) const |
| Sets the data of the data member, if the source is a reference, this function should perform in place replacement of the value. More... | |
Public Member Functions inherited from Member | |
| Member (const std::string &name, const std::string &help) | |
| virtual | ~Member () |
| std::string | GetHelp () const |
| Returns the help string. Help strings may contain markdown notation. More... | |
| std::string | GetName () const |
| Returns the name of this member. More... | |
| const Member * | GetOwner () const |
| std::string | GetQualifiedName () const |
| Returns the namespace qualified name of this member. More... | |
Protected Member Functions | |
| virtual void | set (Data &source, Data &value) const override |
| This function should perform set operation. More... | |
Protected Member Functions inherited from MappedROInstanceMember_Function | |
| template<class F_ > | |
| MappedROInstanceMember_Function (F_ reader, const std::string &name, const std::string &help, const Type *type, const Type *parent, bool isconstfn, bool isreffn, bool constant, bool ref, bool readonly) | |
| virtual Data | get (Scripting::Data &data) const override |
| This function should return the value of this member. More... | |
| virtual void | typecheck (const Type *type) const override |
| Type checks the parent. More... | |
Protected Member Functions inherited from Member | |
| virtual void | SetParent (const Member &parent) |
| Changes the parent of the member. More... | |
Additional Inherited Members | |
Protected Attributes inherited from MappedROInstanceMember_Function | |
| Scripting::Function | fn |
| Scripting::Function::Overload * | readerfn |
Protected Attributes inherited from InstanceMember | |
| bool | constant |
| This instance member is a constant. More... | |
| bool | readonly |
| Marks this instance as read-only. More... | |
| bool | reference |
| This instance member is a reference. More... | |
| const Type * | type |
| Type of the datamember. More... | |
Protected Attributes inherited from Member | |
| std::string | help |
| Help string of the datamember. More... | |
| std::string | name |
| The name of the datamember. More... | |
| const Member * | parent |
This class allows mapping of a data member to c++ function data member.
First template parameter is the type of the object and the second is the type of the data member. The given function is bound to a runtime function. If the function returns reference, this member could be changed, otherwise it would be treated as non-ref temporary. If the member is not a reference but the function returs ref, isreffn should be set to true.
| MappedInstanceMember_Function | ( | F1_ | reader, |
| F2_ | writer, | ||
| const std::string & | name, | ||
| const std::string & | help, | ||
| const Type * | type, | ||
| const Type * | parent, | ||
| bool | isconstfn, | ||
| bool | isreffn, | ||
| bool | ref, | ||
| bool | isgetconst, | ||
| bool | issetconst = false |
||
| ) |
Constructs a new MappedInstanceMember_Function.
| reader | the reader function that would be used to read the value |
| name | name of the instance member |
| help | help text of the instance member |
| type | type of the instance member |
| parent | the type contains this instance member |
| iscontfn | whether the reader function is a constant member function |
| isreffn | whether the reader function is a reference returning function. Returning reference from function allows changes to the instance member. |
| constant | whether this instance member can be changed. If isreffn is set to false, this must be true. |
References Function::AddOverload(), Data::Invalid(), Gorgon::Scripting::MapFunction(), and InstanceMember::type.
This function should perform set operation.
Reimplemented from MappedROInstanceMember_Function.
References VirtualMachine::ExecuteFunction(), and VirtualMachine::Get().