BFLibCPP 0.1
CPP Library
Loading...
Searching...
No Matches
BF::Array< T, S > Class Template Reference

#include <array.hpp>

Inheritance diagram for BF::Array< T, S >:
Collaboration diagram for BF::Array< T, S >:

Public Member Functions

 Array ()
 
 Array (T *array, S size)
 
 Array (std::initializer_list< T > list)
 
virtual ~Array ()
 
void removeAll ()
 
void set (T *array, S size)
 
void set (std::initializer_list< T > list)
 
void setAllocationCallback (T *(*cb)(S size))
 
void setDeallocationCallback (void(*cb)(T *value))
 
virtual bool contains (T object)
 
objectAtIndex (S index) const
 
indexForObject (T object) const
 
virtual S count () const
 Returns _count.
 
virtual void print ()
 
void setComparator (int(*callback)(T a, T b))
 
void setReleaseCallback (void(*callback)(T obj))
 
void copyFromArray (const Array< T > *arr)
 
int add (T obj)
 
int insertObjectAtIndex (T obj, S index)
 
int removeObjectAtIndex (S index)
 
operator[] (S index) const
 
void operator= (const std::initializer_list< T > &list)
 
Array< T > & operator= (const Array< T > &arr)
 
- Public Member Functions inherited from BF::Object
 Object ()
 
 Object (Object &obj)
 
virtual ~Object ()
 

Static Public Member Functions

static int comparisonDefault (T a, T b)
 
- Static Public Member Functions inherited from BF::Object
static void retain (Object *obj)
 
static void release (Object *obj)
 
static int retainCount (Object *obj)
 
static int retainCount (Object &obj)
 

Protected Member Functions

T * address () const
 

Detailed Description

template<typename T, typename S = size_t>
class BF::Array< T, S >

Mutable Array

This class allows you to access the array. This class is meant to provide you the basic functionality of an array class

Objects stored in array are assumed to be owned by owner of array object

Constructor & Destructor Documentation

◆ Array() [1/3]

template<typename T , typename S = size_t>
BF::Array< T, S >::Array ( )
inline
Here is the call graph for this function:

◆ Array() [2/3]

template<typename T , typename S = size_t>
BF::Array< T, S >::Array ( T * array,
S size )
inline

Initializes with array

Here is the call graph for this function:

◆ Array() [3/3]

template<typename T , typename S = size_t>
BF::Array< T, S >::Array ( std::initializer_list< T > list)
inline

Initializes with initializer

Here is the call graph for this function:

◆ ~Array()

template<typename T , typename S = size_t>
virtual BF::Array< T, S >::~Array ( )
inlinevirtual
Here is the call graph for this function:

Member Function Documentation

◆ add()

template<typename T , typename S = size_t>
int BF::Array< T, S >::add ( T obj)
inline

Adds object at the end of the array

◆ address()

template<typename T , typename S = size_t>
T * BF::Array< T, S >::address ( ) const
inlineprotected

Returns address of array

◆ comparisonDefault()

template<typename T , typename S = size_t>
static int BF::Array< T, S >::comparisonDefault ( T a,
T b )
inlinestatic

Compares the raw value of a and b

◆ contains()

template<typename T , typename S = size_t>
virtual bool BF::Array< T, S >::contains ( T object)
inlinevirtual

Returns false if argument could not be found

This function uses the _callback comparison function to compare each function

◆ copyFromArray()

template<typename T , typename S = size_t>
void BF::Array< T, S >::copyFromArray ( const Array< T > * arr)
inline

Copies content from arr to us

Here is the call graph for this function:

◆ count()

template<typename T , typename S = size_t>
virtual S BF::Array< T, S >::count ( ) const
inlinevirtual

Returns _count.

◆ indexForObject()

template<typename T , typename S = size_t>
S BF::Array< T, S >::indexForObject ( T object) const
inline

Returns the value's index. If we could not find it, -1 will be returned

This will return the first match

◆ insertObjectAtIndex()

template<typename T , typename S = size_t>
int BF::Array< T, S >::insertObjectAtIndex ( T obj,
S index )
inline

◆ objectAtIndex()

template<typename T , typename S = size_t>
T BF::Array< T, S >::objectAtIndex ( S index) const
inline

Returns null if argument could not be found

◆ operator=() [1/2]

template<typename T , typename S = size_t>
Array< T > & BF::Array< T, S >::operator= ( const Array< T > & arr)
inline

Copies the string content from arr to us

Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T , typename S = size_t>
void BF::Array< T, S >::operator= ( const std::initializer_list< T > & list)
inline

◆ operator[]()

template<typename T , typename S = size_t>
T BF::Array< T, S >::operator[] ( S index) const
inline
Here is the call graph for this function:

◆ print()

template<typename T , typename S = size_t>
virtual void BF::Array< T, S >::print ( )
inlinevirtual

Prints the array from the first element to the last

◆ removeAll()

template<typename T , typename S = size_t>
void BF::Array< T, S >::removeAll ( )
inline

◆ removeObjectAtIndex()

template<typename T , typename S = size_t>
int BF::Array< T, S >::removeObjectAtIndex ( S index)
inline

removes object at index

this dynamically adjusts the memory

◆ set() [1/2]

template<typename T , typename S = size_t>
void BF::Array< T, S >::set ( std::initializer_list< T > list)
inline

Initializes with initializer

◆ set() [2/2]

template<typename T , typename S = size_t>
void BF::Array< T, S >::set ( T * array,
S size )
inline

Initializes with array

◆ setAllocationCallback()

template<typename T , typename S = size_t>
void BF::Array< T, S >::setAllocationCallback ( T *(* cb )(S size))
inline

Establishes how allocation works

By default free store is utilized

◆ setComparator()

template<typename T , typename S = size_t>
void BF::Array< T, S >::setComparator ( int(* callback )(T a, T b))
inline

Rename comparator to compare callback

◆ setDeallocationCallback()

template<typename T , typename S = size_t>
void BF::Array< T, S >::setDeallocationCallback ( void(* cb )(T *value))
inline

Establishes how deallocation works

By default free store is utilized

◆ setReleaseCallback()

template<typename T , typename S = size_t>
void BF::Array< T, S >::setReleaseCallback ( void(* callback )(T obj))
inline

sets release callback


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