Gorgon Game Engine
Namespace Class Reference

Namespace contains other static members as members. More...

Inheritance diagram for Namespace:
[legend]

Public Member Functions

 Namespace (const std::string &name, const std::string &help)
 
virtual void AddMember (StaticMember &member)
 Adds a new member to this namespace. More...
 
virtual void AddMember (StaticMember *member)
 Adds a new member to this namespace. More...
 
virtual void AddMembers (std::initializer_list< StaticMember * > newmembers)
 Adds a list of members to this namespace. More...
 
virtual void AddMembers (std::vector< StaticMember * > newmembers)
 Adds a list of members to this namespace. More...
 
virtual Data Get () const override
 Returns the value of this static member. More...
 
const Scripting::FunctionGetFunction (const std::string &name) const
 Convenience function, returns the function with the given name. More...
 
virtual MemberType GetMemberType () const override
 Returns the type of this member. More...
 
const NamespaceGetNamespace (const std::string &name) const
 Convenience function, returns the namespace with the given name. More...
 
const TypeGetType (const std::string &name) const
 Convenience function, returns the type with the given name. More...
 
Data ValueOf (const std::string &name) const
 Convenience function, returns the value of the symbol with the given name. More...
 
- Public Member Functions inherited from StaticMember
 StaticMember (const std::string &name, const std::string &help)
 
bool IsInstanceable () const
 Whether this member can be used to instantiate an object. More...
 
virtual bool IsInstanceMember () const override final
 Returns if this member is an instance member. 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...
 

Public Attributes

const StaticMemberListMembers
 List of static members. More...
 

Protected Attributes

StaticMemberList members
 
- 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
 

Additional Inherited Members

- Public Types inherited from StaticMember
enum  MemberType {
  RegularType, EventType, EnumType, Namespace,
  DataMember, Function, Constant
}
 Possible member types. More...
 
- Protected Member Functions inherited from Member
virtual void SetParent (const Member &parent)
 Changes the parent of the member. More...
 

Detailed Description

Namespace contains other static members as members.

All types and library are also namespaces themselves.

Constructor & Destructor Documentation

◆ Namespace()

Namespace ( const std::string &  name,
const std::string &  help 
)

Member Function Documentation

◆ AddMember() [1/2]

virtual void AddMember ( StaticMember member)
virtual

◆ AddMember() [2/2]

virtual void AddMember ( StaticMember member)
virtual

◆ AddMembers() [1/2]

virtual void AddMembers ( std::initializer_list< StaticMember * >  newmembers)
virtual

Adds a list of members to this namespace.

Reimplemented in Type.

References Hashmap< K_, T_, KeyFn, M_, C_ >::Add(), ASSERT, Hashmap< K_, T_, KeyFn, M_, C_ >::Find(), and Namespace::members.

◆ AddMembers() [2/2]

virtual void AddMembers ( std::vector< StaticMember * >  newmembers)
virtual

Adds a list of members to this namespace.

Reimplemented in Type.

References Hashmap< K_, T_, KeyFn, M_, C_ >::Add(), ASSERT, Hashmap< K_, T_, KeyFn, M_, C_ >::Find(), and Namespace::members.

◆ Get()

virtual Data Get ( ) const
overridevirtual

Returns the value of this static member.

For types and functions, this function returns type and function objects.

Implements StaticMember.

Reimplemented in EnumType, EventType, and Type.

References Gorgon::Scripting::Types::Namespace().

◆ GetFunction()

const Function & GetFunction ( const std::string &  name) const

Convenience function, returns the function with the given name.

If there is no such function, symbol not found error is given.

References Gorgon::Scripting::Types::Function(), StaticMember::Function, and Member::name.

◆ GetMemberType()

virtual MemberType GetMemberType ( ) const
overridevirtual

Returns the type of this member.

Implements StaticMember.

Reimplemented in EnumType, EventType, and Type.

References StaticMember::DataMember.

◆ GetNamespace()

const Namespace & GetNamespace ( const std::string &  name) const

Convenience function, returns the namespace with the given name.

Types are also considered as namespaces as they are derived from it. If there is no such namespace, symbol not found error is given.

References Member::name, and StaticMember::Namespace.

◆ GetType()

const Type & GetType ( const std::string &  name) const

Convenience function, returns the type with the given name.

If there is no such type, symbol not found error is given. Any class that is derived from type is also valid.

References Member::name.

◆ ValueOf()

Data ValueOf ( const std::string &  name) const

Convenience function, returns the value of the symbol with the given name.

References Hashmap< K_, T_, KeyFn, M_, C_ >::Find(), Namespace::members, and Member::name.

Member Data Documentation

◆ Members

const StaticMemberList& Members

List of static members.

◆ members

StaticMemberList members
protected

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