siplasplas
A library for C++ reflection and introspection
cpp::dynamic_reflection::Class Class Reference

Stores dynamic reflection information of a class type. More...

#include <siplasplas/reflection/dynamic/class.hpp>

Inheritance diagram for cpp::dynamic_reflection::Class:
cpp::dynamic_reflection::Entity

Public Member Functions

Enumenum_ (const std::string &name)
 Returns reflection information of a member enumeration type. More...
 
Classclass_ (const std::string &name)
 Returns reflection information of a member class type. More...
 
Fieldfield_ (const std::string &name)
 Returns reflection information of a member object. More...
 
Functionfunction_ (const std::string &name)
 Returns reflection information of a member function. More...
 
const cpp::typeerasure::TypeInfotypeInfo () const
 Returns dynamic type information of the class type.
 
cpp::Any32 create ()
 Default constructs an object of the class type. More...
 
- Public Member Functions inherited from cpp::dynamic_reflection::Entity
Entityparent ()
 Returns a reference to the parent entity The behavior is undefined if the entity has no parent entity (See orphan())
 
Runtimeruntime ()
 Returns a reference to the runtime where the entity is registered. More...
 
const SourceInfo & sourceInfo () const
 Returns source information about the entity.
 
const std::string & name () const
 Returns the name of the entity.
 
const std::string & fullName () const
 Returns the full qualifies name of the entity.
 
const SourceInfo::Kindkind () const
 Returns the kind (Namespace, class, enum, member function, etc) of the entity.
 
bool detached () const
 Checks whether the entity is not registered (attached) into a dynamic reflection runtime. More...
 
bool orphan () const
 Checks if the entity has no parent entity. More...
 
void attach (Runtime &runtime)
 Attaches the entity to a given runtime. More...
 
void attach (const std::weak_ptr< Entity > &parent)
 Attaches the entity to the runtime of a given entity and links that enity as parent. More...
 
void addChild (const std::shared_ptr< Entity > &entity)
 Links the given entity as child of the entity. More...
 
bool isChild (const std::shared_ptr< Entity > &entity) const
 Checks if the given entity is a child entity of this entity. More...
 
bool isChild (const Entity &entity) const
 Checks if the given entity is a child entity of this entity. More...
 
bool isChildByName (const std::string &name) const
 Checks if the entity has a child entity with the given name. More...
 
bool isChildByFullName (const std::string &fullName) const
 Checks if the entity has a child entity with the given name. More...
 
EntitygetChildByFullName (const std::string &fullName)
 Returns a child entity given its full name. More...
 
EntitygetChildByName (const std::string &name)
 Returns a child entity given its name. More...
 
std::vector< std::string > getChildrenNamesByKind (const SourceInfo::Kind &kind)
 Returns the names of the child entities with a given kind. More...
 
std::shared_ptr< Entitypointer ()
 Returns the shared pointer holding the entity object.
 

Static Public Member Functions

static std::shared_ptr< Classcreate (const SourceInfo &sourceInfo, const cpp::typeerasure::TypeInfo &typeInfo)
 Creates a Class entity with the given type information. More...
 
static ClassfromEntity (const std::shared_ptr< Entity > &entity)
 Returns a reference to a class entity from a pointer to an entity. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cpp::dynamic_reflection::Entity
 Entity (const SourceInfo &sourceInfo)
 

Detailed Description

Stores dynamic reflection information of a class type.

Examples:
examples/reflection/dynamic/plugin.cpp.

Member Function Documentation

Class& cpp::dynamic_reflection::Class::class_ ( const std::string &  name)

Returns reflection information of a member class type.

The behavior is undefined if the class has no public member class registered with that name

Parameters
nameName of the member class type
Returns
A reference to the class entity with the class reflection information
Examples:
examples/reflection/dynamic/plugin.cpp.
static std::shared_ptr<Class> cpp::dynamic_reflection::Class::create ( const SourceInfo &  sourceInfo,
const cpp::typeerasure::TypeInfo typeInfo 
)
static

Creates a Class entity with the given type information.

Parameters
sourceInfoClass source information
typeInfoClass type information
Returns
A shared pointer holding the class entity. The returned entity is detached (See cpp::dynamic_reflection::Runtime::addEntity())
Examples:
examples/reflection/dynamic/plugin.cpp.
cpp::Any32 cpp::dynamic_reflection::Class::create ( )

Default constructs an object of the class type.

Returns
A cpp::Any32 object hosting the object. The any has methods and attributes registered pointing to the member functions and objects of the class type, so the returned object can be manipulated in an OOP way
Enum& cpp::dynamic_reflection::Class::enum_ ( const std::string &  name)

Returns reflection information of a member enumeration type.

The behavior is undefined if the class has no public member enumeration registered with that name

Parameters
nameName of the member enumeration type
Returns
A reference to the enumeration entity with the enum reflection information
Examples:
examples/reflection/dynamic/plugin.cpp.
Field& cpp::dynamic_reflection::Class::field_ ( const std::string &  name)

Returns reflection information of a member object.

The behavior is undefined if the class has no public member object registered with that name

Parameters
nameName of the member object
Returns
A reference to the member object (field) entity with the member object reflection information
Examples:
examples/reflection/dynamic/reflection.cpp.
static Class& cpp::dynamic_reflection::Class::fromEntity ( const std::shared_ptr< Entity > &  entity)
static

Returns a reference to a class entity from a pointer to an entity.

This function performs an entity cast from a generic entity pointer to a class entity. The behavior is undefined if the entity is not a class (See Entity::kind())

Parameters
entityA shared pointer to an entity
Returns
A reference to a class entity
Function& cpp::dynamic_reflection::Class::function_ ( const std::string &  name)

Returns reflection information of a member function.

The behavior is undefined if the class has no public member function registered with that name

Parameters
nameName of the member function
Returns
A reference to the function entity with the member function reflection information
Examples:
examples/reflection/dynamic/reflection.cpp.

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