CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::Box::Array Class Reference

#include <CeresEngine/Reflection/Box.collection.hpp>

Inheritance diagram for CeresEngine::Box::Array:
CeresEngine::Box

Public Member Functions

 Array (const Box &other)
 
 Array (Box &&other) noexcept
 
 Array (const Array &)=default
 
Arrayoperator= (const Array &)=default
 
 Array (Array &&) noexcept=default
 
Arrayoperator= (Array &&) noexcept=default
 
TypeID getElementTypeID () const
 Gets the type ID of the array element type.
 
Type getElementType () const
 Get tge type of the array element type.
 
Box operator[] (size_t position) const
 
Box at (size_t position) const
 
Box back () const
 
Box front () const
 
Box empty () const
 Checks if the container has no elements, i.e.
 
size_t size () const
 Returns the number of elements in the container, i.e.
 
void resize (size_t count) const
 Resizes the container to contain count elements, does nothing if count == size().
 
void resize (size_t count, const Box &value) const
 Resizes the container to contain count elements, does nothing if count == size().
 
void clear () const
 Erases all elements from the container.
 
Box capacity () const
 Returns the number of elements that the container has currently allocated space for.
 
void reserve (size_t n) const
 Increase the capacity of the container (the total number of elements that the vector can hold without requiring reallocation) to a value that's greater or equal to newCapacity.
 
Iterator insert (const Iterator &position, Box &&value) const
 Inserts elements at the specified location in the container.
 
Iterator insert (const Iterator &position, const Box &value) const
 
Iterator insert (const Iterator &position, const Iterator &first, const Iterator &last) const
 Inserts elements at the specified location in the container.
 
Iterator erase (const Iterator &position) const
 Erases the specified elements from the container.
 
void pushBack (Box &&value) const
 Appends the given element value to the end of the container.
 
void pushBack (const Box &value) const
 
void popBack () const
 Removes the last element of the container.
 
void pushFront (Box &&value) const
 Appends the given element value to the front of the container.
 
void pushFront (const Box &value) const
 
void popFront () const
 Removes the first element of the container.
 
Iterator begin () const
 Returns an iterator to the first element of the container.
 
Iterator cbegin () const
 Returns an iterator to the first element of the container.
 
Iterator end () const
 Returns an iterator to the element following the last element of the container.
 
Iterator cend () const
 
 Box () noexcept
 Creates a new variant holding an empty value.
 
 Box (const Box &other)
 Creates a new variant by copying another, if possible.
 
 Box (Box &&other) noexcept
 Creates a new variant by moving another, if possible.
 
template<typename T >
requires (!std::is_same_v<std::decay_t<T>, Box>)
 Box (T &&value)
 Creates a new variant from a C++ value.
 
template<typename T >
requires (!std::is_same_v<T, Box>)
 Box (std::reference_wrapper< T > value)
 Creates a new variant from a C++ value.
 
template<typename T , typename... Args>
requires (!std::is_same_v<T, Box>)
 Box (std::in_place_type_t< T >, Args &&... args)
 
 Box (const void *ptr, const TypeInfo *typeInfo)
 
- Public Member Functions inherited from CeresEngine::Box
 Box () noexcept
 Creates a new variant holding an empty value.
 
 Box (const Box &other)
 Creates a new variant by copying another, if possible.
 
Boxoperator= (const Box &other)
 Assigns a variant a new value by copying another, if possible.
 
 Box (Box &&other) noexcept
 Creates a new variant by moving another, if possible.
 
Boxoperator= (Box &&other) noexcept
 Assigns a variant a new value by moving another, if possible.
 
template<typename T >
requires (!std::is_same_v<std::decay_t<T>, Box>)
 Box (T &&value)
 Creates a new variant from a C++ value.
 
template<typename T >
requires (!std::is_same_v<std::decay_t<T>, Box>)
Boxoperator= (T &&value)
 Assigns the variant a new value a C++ value.
 
template<typename T >
requires (!std::is_same_v<T, Box>)
 Box (std::reference_wrapper< T > value)
 Creates a new variant from a C++ value.
 
template<typename T , typename... Args>
requires (!std::is_same_v<T, Box>)
 Box (std::in_place_type_t< T >, Args &&... args)
 
 Box (const void *ptr, const TypeInfo *typeInfo)
 
 ~Box () noexcept
 Destroys the variant. Will call the contained object destructor.
 
bool isSmall () const noexcept
 Determines if the value fits on the small buffer storage.
 
void clear () noexcept
 Clears the variant and makes it empty.
 
bool empty () const noexcept
 Checks if the variant is empty (i.e. holds no value).
 
 operator bool () const noexcept
 Checks if the variant is not empty (i.e. holds a value).
 
template<typename T >
bool eq (const T &value) const
 Checks if a variant holds the same value as another.
 
template<typename T >
bool neq (const T &value) const
 Checks if a variant holds the same value as another.
 
TypeID getTypeID () const noexcept
 Gets the ID of the type held by the variant.
 
Type getType () const noexcept
 Gets the type held by the variant.
 
Type getClassType () const noexcept
 Gets the type held by the variant.
 
const ClassgetClass () const noexcept
 
const EnumgetMetaEnum () const noexcept
 
template<typename T >
bool is () const
 Checks if the value held by the variant is T.
 
bool is (const Type &type) const
 
Box copy () const
 Makes a copy of the object.
 
Box ref () const &
 Gets a reference to the meta value.
 
Box cref () const &
 Gets a reference to the meta value.
 
Box rref () &&
 Gets a reference to the meta value.
 
Box ref () &&
 Gets a reference to the meta value.
 
template<typename T >
Tref () const &
 Gets the value of the variant as a reference to T.
 
template<>
Boxref () const &
 
template<typename T >
T && ref () &&
 Gets the value of the variant as a reference to T.
 
template<>
Box && ref () &&
 
template<typename T >
const Tcref () const
 Gets the value of the variant as a const reference to T.
 
template<>
const Boxcref () const
 
template<typename T >
T && rref () &&
 Gets the value of the variant as a r-value reference to T.
 
template<>
Box && rref () &&
 
voiddata () noexcept
 Returns pointer to decayed type.
 
const voiddata () const noexcept
 Returns pointer to decayed type.
 
template<typename T >
Tdata () const
 Gets the value of the variant as a pointer to const T.
 
template<typename T >
bool canConvert () const
 Checks if the value held by the variant is convertible to T.
 
bool canConvert (const TypeID &target) const
 Checks if the value held by the variant is convertible to T.
 
bool canConvert (const Type &target) const
 Checks if the value held by the variant is convertible to T.
 
bool canConvert (const TypeInfo &target) const
 Checks if the value held by the variant is convertible to T.
 
template<typename T >
T to () const &
 Gets the value of the variant as a T.
 
template<>
Box to () const &
 
Box to (const TypeID &target) const
 Gets the value of the variant as a T.
 
Box to (const Type &target) const
 Gets the value of the variant as a T.
 
Box to (const TypeInfo &target) const
 Gets the value of the variant as a T.
 
template<typename T >
void convert ()
 Converts the variant to type T.
 
template<typename T >
bool tryConvert ()
 Tries to convert the variant to type T.
 
Iterable asIterable () const &
 Views the Box as an Iterable type.
 
Iterable asIterable () &&
 
Iterator asIterator () const &
 Views the Box as an Iterator type.
 
Iterator asIterator () &&
 
Array asArray () const &
 Views the Box as an Array type.
 
Array asArray () &&
 
Map asMap () const &
 Views the Box as an Map type.
 
Map asMap () &&
 
Pointer asPointer () const &
 Views the Box as an Pointer type.
 
Pointer asPointer () &&
 

Private Types

using super = Box
 

Additional Inherited Members

- Static Public Member Functions inherited from CeresEngine::Box
template<typename T , typename... Args>
static Box create (Args &&... args)
 

Member Typedef Documentation

◆ super

using CeresEngine::Box::Array::super = Box
private

Constructor & Destructor Documentation

◆ Array() [1/4]

CeresEngine::Box::Array::Array ( const Box other)
inline

◆ Array() [2/4]

CeresEngine::Box::Array::Array ( Box &&  other)
inlinenoexcept

◆ Array() [3/4]

CeresEngine::Box::Array::Array ( const Array )
default

◆ Array() [4/4]

CeresEngine::Box::Array::Array ( Array &&  )
defaultnoexcept

Member Function Documentation

◆ at()

Box CeresEngine::Box::Array::at ( size_t  position) const

◆ back()

Box CeresEngine::Box::Array::back ( ) const

◆ begin()

Iterator CeresEngine::Box::Array::begin ( ) const

Returns an iterator to the first element of the container.

If the container is empty, the returned iterator will be equal to end().

◆ Box() [1/7]

CeresEngine::Box::Box ( )
noexcept

Creates a new variant holding an empty value.

◆ Box() [2/7]

CeresEngine::Box::Box ( Box &&  other)
noexcept

Creates a new variant by moving another, if possible.

◆ Box() [3/7]

CeresEngine::Box::Box ( const Box other)

Creates a new variant by copying another, if possible.

◆ Box() [4/7]

CeresEngine::Box::Box ( const void ptr,
const TypeInfo typeInfo 
)
explicit

◆ Box() [5/7]

template<typename T , typename... Args>
requires (!std::is_same_v<T, Box>)
CeresEngine::Box::Box ( std::in_place_type_t< T ,
Args &&...  args 
)
explicit

◆ Box() [6/7]

template<typename T >
requires (!std::is_same_v<T, Box>)
CeresEngine::Box::Box ( std::reference_wrapper< T value)

Creates a new variant from a C++ value.

◆ Box() [7/7]

template<typename T >
requires (!std::is_same_v<std::decay_t<T>, Box>)
CeresEngine::Box::Box ( T &&  value)

Creates a new variant from a C++ value.

◆ capacity()

Box CeresEngine::Box::Array::capacity ( ) const

Returns the number of elements that the container has currently allocated space for.

◆ cbegin()

Iterator CeresEngine::Box::Array::cbegin ( ) const

Returns an iterator to the first element of the container.

If the container is empty, the returned iterator will be equal to end().

◆ cend()

Iterator CeresEngine::Box::Array::cend ( ) const

◆ clear()

void CeresEngine::Box::Array::clear ( ) const

Erases all elements from the container.

After this call, size() returns zero.

Invalidates any references, pointers, or iterators referring to contained elements. Any past-the-end iterators are also invalidated.

Leaves the capacity() (if supported) unchanged.

◆ empty()

Box CeresEngine::Box::Array::empty ( ) const

Checks if the container has no elements, i.e.

whether begin() == end().

◆ end()

Iterator CeresEngine::Box::Array::end ( ) const

Returns an iterator to the element following the last element of the container.

This element acts as a placeholder; attempting to access it results in undefined behavior.

◆ erase()

Iterator CeresEngine::Box::Array::erase ( const Iterator position) const

Erases the specified elements from the container.

Removes the element at position.

Invalidates iterators and references at or after the point of the erase, including the end() iterator. The iterator pos must be valid and dereferenceable. Thus the end() iterator (which is valid, but is not dereferenceable) cannot be used as a value for position. The iterator first does not need to be dereferenceable if first == last: erasing an empty range is a no-op.

Parameters
positionThe iterator to the element to remove.
Returns
The iterator following the last removed element.

◆ front()

Box CeresEngine::Box::Array::front ( ) const

◆ getElementType()

Type CeresEngine::Box::Array::getElementType ( ) const
inline

Get tge type of the array element type.

◆ getElementTypeID()

TypeID CeresEngine::Box::Array::getElementTypeID ( ) const

Gets the type ID of the array element type.

◆ insert() [1/3]

Iterator CeresEngine::Box::Array::insert ( const Iterator position,
Box &&  value 
) const

Inserts elements at the specified location in the container.

Inserts value before position.

Parameters
positionThe iterator before which the content will be inserted (position may be the end() iterator).
valueThe element value to insert.
Returns
An iterator pointing to the inserted value.

◆ insert() [2/3]

Iterator CeresEngine::Box::Array::insert ( const Iterator position,
const Box value 
) const

◆ insert() [3/3]

Iterator CeresEngine::Box::Array::insert ( const Iterator position,
const Iterator first,
const Iterator last 
) const

Inserts elements at the specified location in the container.

Inserts elements from range [first, last) before position.

Parameters
positionThe iterator before which the content will be inserted (position may be the end() iterator).
firstThe first element value to insert.
lastThe last element value to insert.
Returns
An iterator pointing to the inserted value.

◆ operator=() [1/2]

Array & CeresEngine::Box::Array::operator= ( Array &&  )
defaultnoexcept

◆ operator=() [2/2]

Array & CeresEngine::Box::Array::operator= ( const Array )
default

◆ operator[]()

Box CeresEngine::Box::Array::operator[] ( size_t  position) const

◆ popBack()

void CeresEngine::Box::Array::popBack ( ) const

Removes the last element of the container.

Calling popBack on an empty container results in undefined behavior. Iterators and references to the last element, as well as the end() iterator, are invalidated.

◆ popFront()

void CeresEngine::Box::Array::popFront ( ) const

Removes the first element of the container.

Calling popFront on an empty container results in undefined behavior. All Iterators and references are invalidated.

◆ pushBack() [1/2]

void CeresEngine::Box::Array::pushBack ( Box &&  value) const

Appends the given element value to the end of the container.

The value is moved into the new element.

If the new size() is greater than capacity() then all iterators and references (including the end() iterator) are invalidated. Otherwise only the end() iterator is invalidated.

Parameters
valueThe value of the element to append.

◆ pushBack() [2/2]

void CeresEngine::Box::Array::pushBack ( const Box value) const

◆ pushFront() [1/2]

void CeresEngine::Box::Array::pushFront ( Box &&  value) const

Appends the given element value to the front of the container.

The value is moved into the new element.

All iterators and references (including the end() iterator) are invalidated.

Parameters
valueThe value of the element to append.

◆ pushFront() [2/2]

void CeresEngine::Box::Array::pushFront ( const Box value) const

◆ reserve()

void CeresEngine::Box::Array::reserve ( size_t  n) const

Increase the capacity of the container (the total number of elements that the vector can hold without requiring reallocation) to a value that's greater or equal to newCapacity.

If newCapacity is greater than the current capacity(), new storage is allocated, otherwise the function does nothing.

reserve() does not change the size of the container. If newCapacity is greater than capacity(), all iterators, including the end() iterator, and all references to the elements are invalidated. Otherwise, no iterators or references are invalidated.

After a call to reserve(), insertions will not trigger reallocation unless the insertion would make the size of the container greater than the value of capacity().

◆ resize() [1/2]

void CeresEngine::Box::Array::resize ( size_t  count) const

Resizes the container to contain count elements, does nothing if count == size().

If the current size is greater than count, the container is reduced to its first count elements.

If the current size is less than count, additional default-inserted elements are appended 2) additional copies of value are appended.

◆ resize() [2/2]

void CeresEngine::Box::Array::resize ( size_t  count,
const Box value 
) const

Resizes the container to contain count elements, does nothing if count == size().

If the current size is greater than count, the container is reduced to its first count elements.

If the current size is less than count, additional copies of value are appended.

◆ size()

size_t CeresEngine::Box::Array::size ( ) const

Returns the number of elements in the container, i.e.

std::distance(begin(), end()).


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