Gorgon Game Engine
MappedInstanceMember_Function Class Reference

This class allows mapping of a data member to c++ function data member. More...

Inheritance diagram for MappedInstanceMember_Function:
[legend]

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 TypeGetType () 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 MemberGetOwner () 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::Overloadreaderfn
 
- 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 Typetype
 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 Memberparent
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ MappedInstanceMember_Function()

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.

Parameters
readerthe reader function that would be used to read the value
namename of the instance member
helphelp text of the instance member
typetype of the instance member
parentthe type contains this instance member
iscontfnwhether the reader function is a constant member function
isreffnwhether the reader function is a reference returning function. Returning reference from function allows changes to the instance member.
constantwhether 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.

Member Function Documentation

◆ set()

virtual void set ( Data source,
Data value 
) const
overrideprotectedvirtual

This function should perform set operation.

Reimplemented from MappedROInstanceMember_Function.

References VirtualMachine::ExecuteFunction(), and VirtualMachine::Get().


The documentation for this class was generated from the following file: