Game Engine
Architected a C++ game engine with a runtime reflection system - employing Chain of
Loading...
Searching...
No Matches
Fiea::Engine::Content::Scope Class Reference

#include <Scope.h>

Inheritance diagram for Fiea::Engine::Content::Scope:
[legend]
Collaboration diagram for Fiea::Engine::Content::Scope:
[legend]

Public Member Functions

 Scope ()=default
 Scope (const Scope &rhs)
 Copy constructor.
 Scope (Scope &&rhs) noexcept
 Move constructor.
Scopeoperator= (const Scope &rhs)
 Copy assignment operator.
Scopeoperator= (Scope &&rhs) noexcept
 Move assignment operator.
virtual ~Scope ()
 Destructor. Clears the Scope.
bool operator== (const Scope &rhs) const
 Equality operator.
bool operator!= (const Scope &rhs) const
 Inequality operator.
DatumFind (const string &key)
 Finds a Datum by key.
const DatumFind (const string &key) const
 Finds a Datum by key (const version).
DatumAppend (const string &key)
 Appends a new Datum with the given key.
void RemoveDatum (const string &key)
DatumSearch (const string &key)
Datumoperator[] (const string &key)
 Overloads operator[] for accessing a Datum by key. If the key does not exist in the Scope, it is appended.
Datumoperator[] (size_t idx)
 Overloads operator[] for accessing a Datum by index. Retrieves the Datum corresponding to the given index in the ordered list.
size_t Size () const
 Returns the number of key-value pairs in the Scope.
void Clear ()
 Clears all data in the Scope.
ScopeAppendScope (const string &key, Scope *scope=nullptr)
 Appends a new Scope as a child under the specified key.
void Adopt (const string &key, Scope &child)
 Adopts an existing Scope as a child under the specified key.
ScopeGetParent () const
void SetParent (Scope &parent)
ScopeOrphan ()
 Removes this Scope from its parent.
DatumFindContainedScope (const Scope &child, size_t &idx)
 Finds the Datum that contains the specified child Scope.
const DatumFindContainedScope (const Scope &child, size_t &idx) const
 Finds the Datum that contains the specified child Scope (const version).
bool IsAncestorOf (const Scope &descendent) const
 Checks if this Scope is an ancestor of the specified descendent Scope.
bool IsDescendentOf (const Scope &ancestor) const
 Checks if this Scope is a descendent of the specified ancestor Scope.
virtual ScopeClone () const
Public Member Functions inherited from Fiea::Engine::RTTI
 RTTI ()=default
 RTTI (const RTTI &)=default
RTTIoperator= (const RTTI &)=default
 RTTI (RTTI &&) noexcept=default
RTTIoperator= (RTTI &&) noexcept=default
virtual ~RTTI ()=default
virtual IdType TypeIdInstance () const =0
virtual bool Is (IdType) const
template<typename T>
T * As ()
template<typename T>
const T * As () const
virtual std::string ToString () const
virtual bool Equals (const RTTI *rhs) const

Protected Member Functions

std::vector< const string * > GetOrderedDatums ()

Additional Inherited Members

Public Types inherited from Fiea::Engine::RTTI
using IdType = std::size_t

Constructor & Destructor Documentation

◆ Scope() [1/3]

Fiea::Engine::Content::Scope::Scope ( )
default
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Scope() [2/3]

Fiea::Engine::Content::Scope::Scope ( const Scope & rhs)

Copy constructor.

Parameters
rhsThe Scope to copy from.
Here is the call graph for this function:

◆ Scope() [3/3]

Fiea::Engine::Content::Scope::Scope ( Scope && rhs)
noexcept

Move constructor.

Parameters
rhsThe Scope to move from.
Here is the call graph for this function:

◆ ~Scope()

Fiea::Engine::Content::Scope::~Scope ( )
virtual

Destructor. Clears the Scope.

Here is the call graph for this function:

Member Function Documentation

◆ Adopt()

void Fiea::Engine::Content::Scope::Adopt ( const string & key,
Scope & child )

Adopts an existing Scope as a child under the specified key.

Parameters
keyThe key under which to adopt the child Scope.
childA reference to the child Scope to be adopted.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Append()

Datum & Fiea::Engine::Content::Scope::Append ( const string & key)

Appends a new Datum with the given key.

Parameters
keyThe key for the new Datum.
Returns
Reference to the newly created or existing Datum.
Here is the caller graph for this function:

◆ AppendScope()

Scope & Fiea::Engine::Content::Scope::AppendScope ( const string & key,
Scope * scope = nullptr )

Appends a new Scope as a child under the specified key.

Parameters
keyThe key under which the child Scope is to be appended.
scopeA pointer to an optional pre-created Scope. If nullptr, a new Scope is allocated.
Returns
Scope& A reference to the appended child Scope.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clear()

void Fiea::Engine::Content::Scope::Clear ( )

Clears all data in the Scope.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clone()

Scope * Fiea::Engine::Content::Scope::Clone ( ) const
virtual

◆ Find() [1/2]

Datum * Fiea::Engine::Content::Scope::Find ( const string & key)

Finds a Datum by key.

Parameters
keyThe key to search for.
Returns
A pointer to the Datum if found, otherwise nullptr.
Here is the caller graph for this function:

◆ Find() [2/2]

const Datum * Fiea::Engine::Content::Scope::Find ( const string & key) const

Finds a Datum by key (const version).

Parameters
keyThe key to search for.
Returns
A pointer to the Datum if found, otherwise nullptr.

◆ FindContainedScope() [1/2]

Datum * Fiea::Engine::Content::Scope::FindContainedScope ( const Scope & child,
size_t & idx )

Finds the Datum that contains the specified child Scope.

Parameters
childA reference to the child Scope to search for.
idx[out] The index within the Datum where the child was found. Set to -1 if not found.
Returns
Datum* A pointer to the Datum containing the child, or nullptr if not found.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindContainedScope() [2/2]

const Datum * Fiea::Engine::Content::Scope::FindContainedScope ( const Scope & child,
size_t & idx ) const

Finds the Datum that contains the specified child Scope (const version).

Parameters
childA reference to the child Scope to search for.
idx[out] The index within the Datum where the child was found. Set to -1 if not found.
Returns
Datum* A pointer to the Datum containing the child, or nullptr if not found.
Here is the call graph for this function:

◆ GetOrderedDatums()

std::vector< const string * > Fiea::Engine::Content::Scope::GetOrderedDatums ( )
inlineprotected
Here is the caller graph for this function:

◆ GetParent()

Scope * Fiea::Engine::Content::Scope::GetParent ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsAncestorOf()

bool Fiea::Engine::Content::Scope::IsAncestorOf ( const Scope & descendent) const

Checks if this Scope is an ancestor of the specified descendent Scope.

Parameters
descendentThe Scope to check.
Returns
true if this Scope is an ancestor of the descendent, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsDescendentOf()

bool Fiea::Engine::Content::Scope::IsDescendentOf ( const Scope & ancestor) const

Checks if this Scope is a descendent of the specified ancestor Scope.

Parameters
ancestorThe potential ancestor Scope.
Returns
true if this Scope is a descendent of the ancestor, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool Fiea::Engine::Content::Scope::operator!= ( const Scope & rhs) const

Inequality operator.

Parameters
rhsThe Scope to compare with.
Returns
True if the scopes are not equal, false otherwise.
Here is the call graph for this function:

◆ operator=() [1/2]

Scope & Fiea::Engine::Content::Scope::operator= ( const Scope & rhs)

Copy assignment operator.

Parameters
rhsThe Scope to copy from.
Returns
Reference to this Scope.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [2/2]

Scope & Fiea::Engine::Content::Scope::operator= ( Scope && rhs)
noexcept

Move assignment operator.

Parameters
rhsThe Scope to move from.
Returns
Reference to this Scope.
Here is the call graph for this function:

◆ operator==()

bool Fiea::Engine::Content::Scope::operator== ( const Scope & rhs) const

Equality operator.

Parameters
rhsThe Scope to compare with.
Returns
True if the scopes are equal, false otherwise.
Here is the call graph for this function:

◆ operator[]() [1/2]

Datum & Fiea::Engine::Content::Scope::operator[] ( const string & key)

Overloads operator[] for accessing a Datum by key. If the key does not exist in the Scope, it is appended.

Parameters
keyThe key associated with the Datum.
Returns
Datum& A reference to the Datum corresponding to the key.
Here is the call graph for this function:

◆ operator[]() [2/2]

Datum & Fiea::Engine::Content::Scope::operator[] ( size_t idx)

Overloads operator[] for accessing a Datum by index. Retrieves the Datum corresponding to the given index in the ordered list.

Parameters
idxThe index of the Datum.
Returns
Datum& A reference to the Datum at the specified index.

◆ Orphan()

Scope * Fiea::Engine::Content::Scope::Orphan ( )
nodiscard

Removes this Scope from its parent.

Returns
Scope* A pointer to this Scope after it has been orphaned.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveDatum()

void Fiea::Engine::Content::Scope::RemoveDatum ( const string & key)
Here is the caller graph for this function:

◆ Search()

Datum * Fiea::Engine::Content::Scope::Search ( const string & key)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetParent()

void Fiea::Engine::Content::Scope::SetParent ( Scope & parent)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Size()

size_t Fiea::Engine::Content::Scope::Size ( ) const

Returns the number of key-value pairs in the Scope.

Returns
size_t The number of entries in the Scope.
Here is the caller graph for this function:

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