GTAdhocAPI
Gran Turismo (6) Adhoc API Documentation
Loading...
Searching...
No Matches
System::Array Class Reference

Stores a collection of items. More...

Inheritance diagram for System::Array:
System::Object

Public Member Functions

 Array ()
 constructor taking no param More...
 
 Array (Int size)
 Creates an array with the specified size. More...
 
Int resize (Int size)
 Same effect as size. More...
 
void reserve ()
 Obsolete? More...
 
void unshift (Object obj)
 Adds one element to the beginning of the array. More...
 
void shift ()
 Removes one element from the beginning of the array. More...
 
ByteData pack (String fmt)
 Binary packs the array. More...
 
void push (Object obj)
 Pushes an element to the end of the array. More...
 
Object pop ()
 Pops (removes) an element from the beginning of the array. More...
 
String join (String separator)
 Joins the array elements into one string with the provided separator. More...
 
void concat (Object obj)
 Concatenates (adds) an element to the array. More...
 
void append (Object obj)
 Appends (adds) an element to the array. More...
 
Int bsearch (Object obj)
 Binary searches the array for an array element and returns the index of the element if found. More...
 
void move (Int index_src, Int index_target)
 Moves (swaps) an element from an array index to another. NOTE: Out of range can crash the engine. More...
 
void sort ()
 Sorts an array in-place using the default comparer. More...
 
void sort (Function< Object, Object > comparer)
 Sorts an array in-place using the provided comparer. More...
 
void erase (Int index)
 Erases an element from the array by index. No error will be returned if out of range. More...
 
Int indexOf (Object obj)
 Gets the index of an element. More...
 
Int indexOf (Object obj, Int start_index)
 Gets the index of an element starting from array position. More...
 
Int indexOf (Object obj, Int start_index, Int count)
 Gets the index of an element starting from array position and count of elements starting from it. More...
 
void rotate (Int shift_count)
 Shifts all the elements backwards (wraps at end of array) by the specified count. More...
 
Array reverse ()
 Reverses the array elements. More...
 
void randomShuffle ()
 Randomly shuffles the array. More...
 
void randomShuffle (UInt seed)
 Shuffles the array using the provided seed (normally a seed from MRandom). More...
 
void clear ()
 Clears the array. More...
 
Bool empty ()
 Returns whether the array is empty. More...
 
 operator+ ()
 Appends an element (or elements from a source array). More...
 
void each (FunctionObject< Object > cb)
 Performs a callback on each element. More...
 
Array map (FunctionObject< Object > cb)
 Creates a new array populated with the results of calling a provided function on every element in the calling array. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 constructor taking no param More...
 
Bool isInstanceOf (Class classType)
 Returns whether an object is of a specific class/type. More...
 
Object getDeepCopy ()
 Gets a deep copy of this object. More...
 
void setDeepCopy (Object obj)
 Unk. More...
 
String dump ()
 Dumps all info about an object. More...
 
Object getObjectAttribute (string path)
 
void setObjectAttribute (string path, Object value)
 
Bool hasPrimitiveInterface ()
 Returns whether this object has a primitive interface. More...
 
Bool toBool ()
 Casts this object to Bool. More...
 
Byte toByte ()
 Casts this object to Byte. More...
 
Short toShort ()
 Casts this object to Short. More...
 
Int toInt ()
 Casts this object to Int. More...
 
Long toLong ()
 Casts this object to Long. More...
 
UByte toUByte ()
 Casts this object to UByte. More...
 
UShort toUShort ()
 Casts this object to UShort. More...
 
UInt toUInt ()
 Casts this object to UInt. More...
 
ULong toULong ()
 Casts this object to ULong. More...
 
Float toFloat ()
 Casts this object to Float. More...
 
Double toDouble ()
 Casts this object to Double. More...
 
String toString ()
 Casts this object to String. More...
 
Symbol toSymbol ()
 Casts this object to Symbol. More...
 
Bool hasArrayInterface ()
 Returns whether this object has an Array interface. More...
 
Int getArrayCount ()
 Gets the Array item count for this object. More...
 
void setArrayCount ()
 Sets the Array item count for this object. More...
 
Object getArrayElement (Object arg0)
 Gets an Array item for this object. More...
 
void setArrayElement (Object arg0, Object arg1)
 Sets the Array item for this object. More...
 
Bool hasMapInterface ()
 Returns whether this object has a Map interface. More...
 
int getMapCount ()
 Returns the count of items in the map. More...
 
void setMapElement (Object arg0, Object arg1)
 Returns whether the Map has a specific object key. Bool hasMapElement(Object arg0);. More...
 
Object getMapElement (Object arg0)
 Gets a Map element by key. More...
 
void hasGeneratorInterface ()
 Returns whether this object has a generator interface. More...
 
Iterator generator ()
 Returns generator (?) More...
 
void hasIteratorInterface ()
 Returns whether this object has an iterator. More...
 
Iterator iterator ()
 Gets the iterator for this object. More...
 
void hasVariableInterface ()
 Returns whether this object is a variable. More...
 
void hasFunctionInterface ()
 Returns whether this object has a function interface. More...
 
Object call ()
 Calls this object as a function. More...
 
Bool hasByteDataInterface ()
 Returns whether this object has a byte data interface. More...
 
Int getByteDataCount ()
 Returns the ByteData size for this object. More...
 
void setByteDataCount (Int count)
 Sets the ByteData size for this object. More...
 
Int getByteDataCapacity ()
 Returns the ByteData capacity for this object. More...
 
void setByteDataCapacity (Int capacity)
 Sets the ByteData capacity for this object. More...
 
ByteData getByteData ()
 Gets the underlaying ByteData. More...
 
void setByteData (ByteData bytedata)
 Sets the underlaying ByteData. More...
 
void hasObjectSelectorInterface ()
 Returns whether this object has an object selector interface. More...
 
void self ()
 Gets the get for this object if it has a get interface. More...
 
void getArchiveTree ()
 
void setArchiveTree ()
 
ByteData serialize ()
 Serializes this object. More...
 
void deserialize (ByteData serializedData)
 Deserializes this object. More...
 
void defined (Object obj)
 Returns whether a certain object is defined within this object. More...
 
Array find_all (FunctionObject func)
 Finds all the elements in this object that matches the predicates. More...
 
void each_all (FunctionObject func)
 Applies callback to all elements in this object. More...
 
Array map_all (FunctionObject< Object > func)
 Maps all the elements in this object. More...
 
Bool operator!= ()
 Returns whether this object is not equal to another. More...
 
Bool operator== ()
 Returns whether this object is equal to another. More...
 

Public Attributes

Int size
 Gets or sets the array size. More...
 
Iterator iterator_with_index
 Returns an iterator returning [index, element]. More...
 
- Public Attributes inherited from System::Object
Int rc_size
 Getter-only. Reference counter size of this object. More...
 
Object rc_class
 Getter-only. Type name of the object. More...
 
Int rc_count
 Getter-only. Reference count of this object. More...
 
Int weak_count
 Getter-only. Weak reference count of this object. More...
 
Class class_id
 Class (type) object for this object. More...
 

Detailed Description

Stores a collection of items.

Definition at line 4 of file Array.cpp.

Constructor & Destructor Documentation

◆ Array() [1/2]

System::Array::Array ( )
inline

constructor taking no param

Definition at line 9 of file Array.cpp.

◆ Array() [2/2]

System::Array::Array ( Int  size)
inline

Creates an array with the specified size.

Definition at line 12 of file Array.cpp.

Member Function Documentation

◆ append()

void System::Array::append ( Object  obj)

Appends (adds) an element to the array.

◆ bsearch()

Int System::Array::bsearch ( Object  obj)

Binary searches the array for an array element and returns the index of the element if found.

Returns
Element index if found. -1 if not found.

◆ clear()

void System::Array::clear ( )

Clears the array.

◆ concat()

void System::Array::concat ( Object  obj)

Concatenates (adds) an element to the array.

◆ each()

void System::Array::each ( FunctionObject< Object cb)

Performs a callback on each element.

var arr = [];
arr.push(1);
arr.push(2);
arr.push(3);
static sum = 0;
function doSum(a)
{
sum += a;
}
arr.each(doSum);
return sum; // 6

◆ empty()

Bool System::Array::empty ( )

Returns whether the array is empty.

◆ erase()

void System::Array::erase ( Int  index)

Erases an element from the array by index. No error will be returned if out of range.

◆ indexOf() [1/3]

Int System::Array::indexOf ( Object  obj)

Gets the index of an element.

Returns
Index if found. -1 if not found.

◆ indexOf() [2/3]

Int System::Array::indexOf ( Object  obj,
Int  start_index 
)

Gets the index of an element starting from array position.

Returns
Index if found. -1 if not found.

◆ indexOf() [3/3]

Int System::Array::indexOf ( Object  obj,
Int  start_index,
Int  count 
)

Gets the index of an element starting from array position and count of elements starting from it.

Returns
Index if found. -1 if not found.

◆ join()

String System::Array::join ( String  separator)

Joins the array elements into one string with the provided separator.

◆ map()

Array System::Array::map ( FunctionObject< Object cb)

Creates a new array populated with the results of calling a provided function on every element in the calling array.

◆ move()

void System::Array::move ( Int  index_src,
Int  index_target 
)

Moves (swaps) an element from an array index to another. NOTE: Out of range can crash the engine.

◆ operator+()

System::Array::operator+ ( )
inline

Appends an element (or elements from a source array).

Definition at line 126 of file Array.cpp.

◆ pack()

ByteData System::Array::pack ( String  fmt)

Binary packs the array.

◆ pop()

Object System::Array::pop ( )

Pops (removes) an element from the beginning of the array.

◆ push()

void System::Array::push ( Object  obj)

Pushes an element to the end of the array.

◆ randomShuffle() [1/2]

void System::Array::randomShuffle ( )

Randomly shuffles the array.

◆ randomShuffle() [2/2]

void System::Array::randomShuffle ( UInt  seed)

Shuffles the array using the provided seed (normally a seed from MRandom).

◆ reserve()

void System::Array::reserve ( )

Obsolete?

◆ resize()

Int System::Array::resize ( Int  size)

Same effect as size.

◆ reverse()

Array System::Array::reverse ( )

Reverses the array elements.

◆ rotate()

void System::Array::rotate ( Int  shift_count)

Shifts all the elements backwards (wraps at end of array) by the specified count.

◆ shift()

void System::Array::shift ( )

Removes one element from the beginning of the array.

◆ sort() [1/2]

void System::Array::sort ( )

Sorts an array in-place using the default comparer.

◆ sort() [2/2]

void System::Array::sort ( Function< Object, Object comparer)

Sorts an array in-place using the provided comparer.

Example code for sorting strings backwards

var arr = ["one", "two", "three"];
function sorter(a, b)
{
return b < a;
}
arr.sort(sorter); // [(String)("two"),(String)("three"),(String)("one")]

◆ unshift()

void System::Array::unshift ( Object  obj)

Adds one element to the beginning of the array.

Member Data Documentation

◆ iterator_with_index

Iterator System::Array::iterator_with_index

Returns an iterator returning [index, element].

var arr = ["one", "two", "three"];
foreach (var i in arr.iterator_with_index)
return i; // [0, "one"]

Definition at line 117 of file Array.cpp.

◆ size

Int System::Array::size

Gets or sets the array size.

Definition at line 15 of file Array.cpp.


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