Class ssq::Array

Class List > ssq > Array

Squirrel intance of array object.

  • #include <array.hpp>

Inherits the following classes: ssq::Object

Public Functions

Type Name
Array (HSQUIRRELVM vm, size_t len=0)
Constructs empty array.
Array (HSQUIRRELVM vm, const std::vector< T > & vector)
Constructs array out of std::vector.
Array (const Object & object)
Converts Object toArray .
Array (const Array & other)
Copy constructor.
Array (Array && other)
Move constructor.
T back ()
T begin ()
std::vector< T > convert ()
Converts this array to std::vector of specific type T.
std::vector< Object > convertRaw ()
Converts this array to std::vector of objects.
T get (size_t index)
Returns an element from the specific index.
Array & operator= (const Array & other)
Copy assingment operator.
Array & operator= (Array && other)
Move assingment operator.
void pop ()
Pops an element from the back of the array.
T popAndGet ()
Pops an element from the back of the array and returns it.
void push (const T & value)
Pushes an element to the back of the array.
void set (size_t index, const T & value)
Sets an element at the specific index.
size_t size ()
Returns the size of the array.
virtual ~Array () = default
Destructor.

Public Functions inherited from ssq::Object

Type Name
Object ()
Creates an empty object with null VM .
Object (HSQUIRRELVM vm)
Creates an empty object.
Object (const Object & other)
Copy constructor to copy the object reference.
Object (Object && other)
Move constructor.
Object find (const char * name) const
Finds object within this object.
const HSQUIRRELVM & getHandle () const
Returns the Squirrel virtual machine handle associated with this instance.
const HSQOBJECT & getRaw () const
Returns raw Squirrel object reference.
HSQOBJECT & getRaw ()
Returns raw Squirrel object reference.
Type getType () const
Returns the type of the object.
const char * getTypeStr () const
Returns the type of the object in string format.
size_t getTypeTag () const
Returns the typetag associated with this object.
bool isEmpty () const
Checks if the object is empty.
bool isNull () const
Returns true if the object is nullptr.
Object & operator= (const Object & other)
Copy assingment operator.
Object & operator= (Object && other)
Move assingment operator.
void reset ()
Releases the object and resets it to empty.
void swap (Object & other)
Swaps two objects.
T to () const
Returns an arbitary value of this object.
Array toArray () const
Returns the Array value of this object.
bool toBool () const
Returns the boolean value of this object.
Class toClass () const
Returns the Class value of this object.
float toFloat () const
Returns the float value of this object.
Function toFunction () const
Returns the Function value of this object.
Instance toInstance () const
Returns the Instance value of this object.
int32_t toInt () const
Returns the integer value of this object.
T toPtrUnsafe () const
Unsafe cast this object into any pointer of type T.
std::string toString () const
Returns the string value of this object.
Table toTable () const
Returns the Table value of this object.
virtual ~Object ()

Protected Attributes inherited from ssq::Object

Type Name
HSQOBJECT obj
HSQUIRRELVM vm
bool weak

Public Functions Documentation

function Array [1/5]

ssq::Array::Array (
    HSQUIRRELVM vm,
    size_t len=0
) 

function Array [2/5]

template<typename T typename T>
inline ssq::Array::Array (
    HSQUIRRELVM vm,
    const std::vector< T > & vector
) 

function Array [3/5]

explicit ssq::Array::Array (
    const Object & object
) 

Exception:

function Array [4/5]

ssq::Array::Array (
    const Array & other
) 

function Array [5/5]

ssq::Array::Array (
    Array && other
) 

function back

template<typename T typename T>
inline T ssq::Array::back () 

Returns the element at the end of the array

Exception:

  • TypeException if the array is empty or element cannot be returned

function begin

template<typename T typename T>
inline T ssq::Array::begin () 

Returns the element at the start of the array

Exception:

  • TypeException if the array is empty or element cannot be returned

function convert

template<typename T typename T>
inline std::vector< T > ssq::Array::convert () 

function convertRaw

std::vector< Object > ssq::Array::convertRaw () 

function get

template<typename T typename T>
inline T ssq::Array::get (
    size_t index
) 

Exception:

  • TypeException if the index is out of bounds or element cannot be returned

function operator=

Array & ssq::Array::operator= (
    const Array & other
) 

function operator=

Array & ssq::Array::operator= (
    Array && other
) 

function pop

void ssq::Array::pop () 

function popAndGet

template<typename T typename T>
inline T ssq::Array::popAndGet () 

function push

template<typename T typename T>
inline void ssq::Array::push (
    const T & value
) 

function set

template<typename T typename T>
inline void ssq::Array::set (
    size_t index,
    const T & value
) 

Exception:

  • TypeException if the index is out of bounds or element cannot be set

function size

size_t ssq::Array::size () 

function ~Array

virtual ssq::Array::~Array () = default

The documentation for this class was generated from the following file include/simplesquirrel/array.hpp