Member Class Reference

#include <reflectionbase.h>

Inheritance diagram for Member:

详细描述

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   KIND {
   PACKAGE ,
   CLASS ,
   FUNCTION ,
   INSTANCE_FUNCTION ,
   CONST_INSTANCE_FUNCTION ,
   CONTAINER_TEST ,
   FUNCTION_TEST
}

公共成员函数

enum maxon::reflection::Member::KIND   MAXON_ENUM_FLAGS_CLASS ( KIND )
const MAXON_METHOD Container GetEnclosingContainer () const
MAXON_METHOD KIND   GetKind () const
const MAXON_METHOD Id GetSimpleName () const
const MAXON_METHOD Id GetId () const
MAXON_METHOD String   ToString (const FormatStatement *fs=nullptr) const

静态公共成员函数

static MAXON_METHOD Result < Bool GetMembers (const ValueReceiver < const Member & > &members)
static const MAXON_METHOD Member Find (const Id &memberId)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( Member , MAXON_REFERENCE_NONE , "net.maxon.reflection.interface.member")

Member Enumeration Documentation

◆  KIND

enum KIND
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 函数 (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 

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( Member   ,
MAXON_REFERENCE_NONE   ,
"net.maxon.reflection.interface.member"   
)
private

◆  MAXON_ENUM_FLAGS_CLASS()

enum maxon::reflection::Member::KIND MAXON_ENUM_FLAGS_CLASS ( KIND   )

◆  GetEnclosingContainer()

const MAXON_METHOD 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.

返回
The enclosing container of this member, or nullptr if this is the global package.

◆  GetKind()

MAXON_METHOD KIND GetKind ( ) const

Returns the kind of this member. This allows to tell whether this Member can be safely cast to a Package , Class or 函数 . The returned value has exactly one of the KIND flags set.

返回
Kind of this member.

◆  GetSimpleName()

const MAXON_METHOD Id & GetSimpleName ( ) const

Returns the (unqualified) name of this member. E.g., for maxon::StringInterface::GetLength this is "GetLength".

返回
Name of this member.

◆  GetId()

const MAXON_METHOD 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.

返回
Unique id for this member.

◆  ToString()

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.
返回
The converted result.

◆  GetMembers()

static MAXON_METHOD Result < Bool > GetMembers ( const ValueReceiver < const Member & > &  members )
static

Yields all registered members.

◆  Find()

static const MAXON_METHOD Member * Find ( const Id memberId )
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.
返回
The member with the given memberId , or nullptr.