#include <reflectionbase.h>
Member is the root interface of the reflection hierarchy. A Member may be
All members except the global package have an enclosing container as their parent. For example, the method StringInterface::GetLength() has the class StringInterface as enclosing container, which has the maxon package as enclosing container, which has the global package as enclosing container.
Public Types | |
enum class | KIND { PACKAGE , CLASS , FUNCTION , INSTANCE_FUNCTION , CONST_INSTANCE_FUNCTION , CONTAINER_TEST , FUNCTION_TEST } |
Public Member Functions | |
enum maxon::reflection::Member::KIND | MAXON_ENUM_FLAGS_CLASS (KIND) |
MAXON_METHOD const Container * | GetEnclosingContainer () const |
MAXON_METHOD KIND | GetKind () const |
MAXON_METHOD const Id & | GetSimpleName () const |
MAXON_METHOD const Id & | GetId () const |
MAXON_METHOD String | ToString (const FormatStatement *fs=nullptr) const |
Static Public Member Functions | |
static MAXON_METHOD Result< Bool > | GetMembers (const ValueReceiver< const Member & > &members) |
static MAXON_METHOD const Member * | Find (const Id &memberId) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (Member, MAXON_REFERENCE_NONE, "net.maxon.reflection.interface.member", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
|
strong |
This enum defines the possible kinds of a Member. Exactly one of the flags is set in the value returned by GetKind().
Enumerator | |
---|---|
PACKAGE | The member is a Package. |
CLASS | The member is a Class. |
FUNCTION | The member is a Function (either at package scope, or a static class member). |
INSTANCE_FUNCTION | The member is a non-const instance function (i.e., non-static class member). |
CONST_INSTANCE_FUNCTION | The member is a const instance function (i.e., non-static class member). |
CONTAINER_TEST | |
FUNCTION_TEST |
|
private |
enum maxon::reflection::Member::KIND MAXON_ENUM_FLAGS_CLASS | ( | KIND | ) |
MAXON_METHOD const Container* GetEnclosingContainer | ( | ) | const |
Returns the enclosing container of this member. All members except the global package have such an enclosing container: Functions and classes are nested in classes or packages, packages are nested in other packages.
MAXON_METHOD KIND GetKind | ( | ) | const |
MAXON_METHOD const Id& GetSimpleName | ( | ) | const |
Returns the (unqualified) name of this member. E.g., for maxon::StringInterface::GetLength this is "GetLength".
MAXON_METHOD const Id& GetId | ( | ) | const |
Returns a unique id for this member. This is the qualified name of the member (with dot as separator), plus optionally an additional code for disambiguation, separated by "@". For functions, a hashcode which depends on the parameter and return types is used to disambiguate between overloads (such as "net.maxon.asin@919429e0").
The function Find() allows to find a Member for the id.
MAXON_METHOD String ToString | ( | const FormatStatement * | fs = nullptr | ) | const |
Returns a readable string of the content.
[in] | fs | Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported. |
|
static |
Yields all registered members.
|
static |
Finds the member whose id is memberId
. The id has to be in a format as specified by GetId(). If there is no member with the given memberId
, nullptr is returned.
[in] | memberId | A member id. |
memberId
, or nullptr.