PlayerIO

The fastest way to build online games without breaking a sweat.

Objective-C Client Reference

Multiplayer  class documentationClass PIODatabaseArray

Language: Objective-C

Represents an BigDB array of values that can be accessed by index.

DatabaseArray is very similar to the DatabaseObject class since it has methods for getting, setting, checking and removing values. But unlike DatabaseObject, this class also has methods for adding and inserting values, and there is no save method, since these cannot be saved to a BigDB table, they always have to be a property of an object.

If we for example have an object that can be visualized like this:

Then we would create it in BigDB like this:

However, just like DatabaseObject, DatabaseArray also supports nested property names, and we can refer to values in the array with their index number. Using this, we can make the example object in an easier way, like this:

Getting values works exactly like for DatabaseObject, and we can also use nested properties.

In addition to getting and setting values, we can also add values to the end of the array, insert values in the middle of it, or remove values in the middle of it. Note that the arrays are sparse, this means that removing a value doesn't shift the indexes of the following values, and we can set any value beyond the last value of the array.

Methods

 
- (PIODatabaseArray*)
addArray:
Add the given database array value to the end of this database array
- (PIODatabaseArray*)
addBool:
Add the given boolean value to the end of the database array
- (PIODatabaseArray*)
addData:
Add the given NSData value to the end of the database array
- (PIODatabaseArray*)
addDate:
Add the given NSDate value to the end of the database array
- (PIODatabaseArray*)
addDouble:
Add the given double value to the end of the database array
- (PIODatabaseArray*)
addFloat:
Add the given float value to the end of the database array
- (PIODatabaseArray*)
addInt:
Add the given int value to the end of the database array
- (PIODatabaseArray*)
addLong:
Add the given long value to the end of the database array
- (PIODatabaseArray*)
addObject:
Add the given database object to the end of the database array
- (PIODatabaseArray*)
addString:
Add the given string value to the end of the database array
- (PIODatabaseArray*)
addUInt:
Add the given unsigned integer value to the end of the database array
- (NSArray*)
allIndexes
Get the indexes used in this array
- (NSArray*)
allValues
Get all values from the properties of this array. Primitive properties (integers, floats, etc.) are wrapped in NSNumber
+ (PIODatabaseArray*)
array
Create a new autoreleased PIODatabaseObject
- (PIODatabaseArray*)
arrayAtIndex:
Get the given DatabaseArray property
- (PIODatabaseArray*)
arrayForProperty:
Get the given DatabaseArray property
- (BOOL)
boolAtIndex:
Get the given boolean property
- (BOOL)
boolAtIndex:defaultValue:
Get the given boolean property, or the default if it doesn't exist.
- (BOOL)
boolForProperty:
Get the given boolean property
- (BOOL)
boolForProperty:defaultValue:
Get the given boolean property, or the default if it doesn't exist.
- (BOOL)
containsObjectAtIndex:
Returns true if the given property exists on this object
- (BOOL)
containsProperty:
Returns true if the given property exists on this object
- (NSUInteger)
count
Returns the number of entries in this array
- (NSUInteger)
countByEnumeratingWithState:objects:count:
Fast enumeration over the values in the array
- (NSData*)
dataAtIndex:
Get the given byte array property
- (NSData*)
dataAtIndex:defaultValue:
Get the given byte array property, or the default if it doesn't exist.
- (NSData*)
dataForProperty:
Get the given byte array property
- (NSData*)
dataForProperty:defaultValue:
Get the given byte array property, or the default if it doesn't exist.
- (NSDate*)
dateAtIndex:
Get the given Date property
- (NSDate*)
dateAtIndex:defaultValue:
Get the given Date property, or the default if it doesn't exist.
- (NSDate*)
dateForProperty:
Get the given Date property
- (NSDate*)
dateForProperty:defaultValue:
Get the given Date property, or the default if it doesn't exist.
- (double)
doubleAtIndex:
Get the given double property
- (double)
doubleAtIndex:defaultValue:
Get the given double property, or the default if it doesn't exist.
- (double)
doubleForProperty:
Get the given double property
- (double)
doubleForProperty:defaultValue:
Get the given double property, or the default if it doesn't exist.
- (float)
floatAtIndex:
Get the given float property
- (float)
floatAtIndex:defaultValue:
Get the given float property, or the default if it doesn't exist.
- (float)
floatForProperty:
Get the given float property
- (float)
floatForProperty:defaultValue:
Get the given float property, or the default if it doesn't exist.
- (PIODatabaseArray*)
insertArray:atIndex:
Insert the given database array at the specified index of the database array
- (PIODatabaseArray*)
insertBool:atIndex:
Insert the given boolean value at the specified index of the database array
- (PIODatabaseArray*)
insertData:atIndex:
Insert the given NSData value at the specified index of the database array
- (PIODatabaseArray*)
insertDate:atIndex:
Insert the given NSDate value at the specified index of the database array
- (PIODatabaseArray*)
insertDouble:atIndex:
Insert the given double value at the specified index of the database array
- (PIODatabaseArray*)
insertFloat:atIndex:
Insert the given float value at the specified index of the database array
- (PIODatabaseArray*)
insertInt:atIndex:
Insert the given int value at the specified index of the database array
- (PIODatabaseArray*)
insertLong:atIndex:
Insert the given long value at the specified index of the database array
- (PIODatabaseArray*)
insertObject:atIndex:
Insert the given database object at the specified index of the database array
- (PIODatabaseArray*)
insertString:atIndex:
Insert the given string value at the specified index of the database array
- (PIODatabaseArray*)
insertUInt:atIndex:
Insert the given unsigned integer value at the specified index of the database array
- (int32_t)
intAtIndex:
Get the given int property
- (int32_t)
intAtIndex:defaultValue:
Get the given int property, or the default if it doesn't exist.
- (int32_t)
intForProperty:
Get the given int property
- (int32_t)
intForProperty:defaultValue:
Get the given int property, or the default if it doesn't exist.
- (NSEnumerator*)
keyEnumerator
Enumerator to move over all keys (indexes used) in the array
- (int64_t)
longAtIndex:
Get the given long long property
- (int64_t)
longAtIndex:defaultValue:
Get the given long property, or the default if it doesn't exist.
- (int64_t)
longForProperty:
Get the given long property
- (int64_t)
longForProperty:defaultValue:
Get the given long property, or the default if it doesn't exist.
- (PIODatabaseObject*)
objectAtIndex:
Get the given DatabaseObject property
- (NSEnumerator*)
objectEnumerator
Enumerator to move over all objects in the array
- (PIODatabaseObject*)
objectForProperty:
Get the given DatabaseObject property
- (void)
removeAllObjects
Removes all properties on this array
- (PIODatabaseArray*)
removeObjectAtIndex:
Removes the given entry from this array
- (PIODatabaseArray*)
setArray:atIndex:
Set the array entry too the given DatabaseArray value
- (PIODatabaseArray*)
setArray:forProperty:
Set the specified property to the given DatabaseArray value
- (PIODatabaseArray*)
setBool:atIndex:
Set the array entry too the given boolean value
- (PIODatabaseArray*)
setBool:forProperty:
Set the specified property to the given boolean value
- (PIODatabaseArray*)
setData:atIndex:
Set the array entry to the given bye array value
- (PIODatabaseArray*)
setData:forProperty:
Set the specified property to the given bye array value
- (PIODatabaseArray*)
setDate:atIndex:
Set the array entry to the given Date value
- (PIODatabaseArray*)
setDate:forProperty:
Set the specified property to the given Date value
- (PIODatabaseArray*)
setDouble:atIndex:
Set the array entry to the given double value
- (PIODatabaseArray*)
setDouble:forProperty:
Set the specified property to the given double value
- (PIODatabaseArray*)
setFloat:atIndex:
Set the array entry to the given float value
- (PIODatabaseArray*)
setFloat:forProperty:
Set the specified property to the given float value
- (PIODatabaseArray*)
setInt:atIndex:
Set the array entry to the given int value
- (PIODatabaseArray*)
setInt:forProperty:
Set the specified property to the given int value
- (PIODatabaseArray*)
setLong:atIndex:
Set the array entry to the given long value
- (PIODatabaseArray*)
setLong:forProperty:
Set the specified property to the given long value
- (PIODatabaseArray*)
setObject:atIndex:
Set the array entry to the given DatabaseObject value
- (PIODatabaseArray*)
setObject:forProperty:
Set the specified property to the given DatabaseObject value
- (PIODatabaseArray*)
setString:atIndex:
Set the array entry to the given string value
- (PIODatabaseArray*)
setString:forProperty:
Set the specified property to the given string value
- (PIODatabaseArray*)
setUInt:atIndex:
Set the array entry to the given uint value
- (PIODatabaseArray*)
setUInt:forProperty:
Set the specified property to the given uint value
- (NSString*)
stringAtIndex:
Get the given String property
- (NSString*)
stringAtIndex:defaultValue:
Get the given String property, or the default if it doesn't exist.
- (NSString*)
stringForProperty:
Get the given String property
- (NSString*)
stringForProperty:defaultValue:
Get the given String property, or the default if it doesn't exist.
- (uint32_t)
uintAtIndex:
Get the given uint property
- (uint32_t)
uintAtIndex:defaultValue:
Get the given uint property, or the default if it doesn't exist.
- (uint32_t)
uintForProperty:
Get the given uint property
- (uint32_t)
uintForProperty:defaultValue:
Get the given uint property, or the default if it doesn't exist.
- (id)
valueAtIndex:
Get the given property as an NSObject. Primitive properties (integers, floats, etc.) are wrapped in NSNumber
- (id)
valueForProperty:
Get the given property as an object. Primitive properties (integers, floats, etc.) are wrapped in NSNumber

addArray:

Add the given database array value to the end of this database array

Arguments

PIODatabaseArray* value

Return Value

PIODatabaseArray*

addBool:

Add the given boolean value to the end of the database array

Arguments

BOOL value

Return Value

PIODatabaseArray*

addData:

Add the given NSData value to the end of the database array

Arguments

NSData* value

Return Value

PIODatabaseArray*

addDate:

Add the given NSDate value to the end of the database array

Arguments

NSDate* value

Return Value

PIODatabaseArray*

addDouble:

Add the given double value to the end of the database array

Arguments

double value

Return Value

PIODatabaseArray*

addFloat:

Add the given float value to the end of the database array

Arguments

float value

Return Value

PIODatabaseArray*

addInt:

Add the given int value to the end of the database array

Arguments

int32_t value

Return Value

PIODatabaseArray*

addLong:

Add the given long value to the end of the database array

Arguments

int64_t value

Return Value

PIODatabaseArray*

addObject:

Add the given database object to the end of the database array

Arguments

PIODatabaseObject* value

Return Value

PIODatabaseArray*

addString:

Add the given string value to the end of the database array

Arguments

NSString* value

Return Value

PIODatabaseArray*

addUInt:

Add the given unsigned integer value to the end of the database array

Arguments

uint32_t value

Return Value

PIODatabaseArray*

allIndexes

Get the indexes used in this array

Return Value

NSArray*

allValues

Get all values from the properties of this array. Primitive properties (integers, floats, etc.) are wrapped in NSNumber

Return Value

NSArray*

array

Create a new autoreleased PIODatabaseObject

Return Value

PIODatabaseArray*

arrayAtIndex:

Get the given DatabaseArray property

Arguments

NSUInteger index

Return Value

PIODatabaseArray*

arrayForProperty:

Get the given DatabaseArray property

Arguments

NSString* propertyExpression

Return Value

PIODatabaseArray*

boolAtIndex:

Get the given boolean property

Arguments

NSUInteger index

Return Value

BOOL

boolAtIndex:defaultValue:

Get the given boolean property, or the default if it doesn't exist.

Arguments

NSUInteger index
BOOL defaultValue

Return Value

BOOL

boolForProperty:

Get the given boolean property

Arguments

NSString* propertyExpression

Return Value

BOOL

boolForProperty:defaultValue:

Get the given boolean property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
BOOL defaultValue

Return Value

BOOL

containsObjectAtIndex:

Returns true if the given property exists on this object

Arguments

NSUInteger index

Return Value

BOOL

containsProperty:

Returns true if the given property exists on this object

Arguments

NSString* propertyExpression

Return Value

BOOL

count

Returns the number of entries in this array

Return Value

NSUInteger

countByEnumeratingWithState:objects:count:

Fast enumeration over the values in the array

Arguments

NSFastEnumerationState* state
id* stackbuf
NSUInteger len

Return Value

NSUInteger

dataAtIndex:

Get the given byte array property

Arguments

NSUInteger index

Return Value

NSData*

dataAtIndex:defaultValue:

Get the given byte array property, or the default if it doesn't exist.

Arguments

NSUInteger index
NSData* defaultValue

Return Value

NSData*

dataForProperty:

Get the given byte array property

Arguments

NSString* propertyExpression

Return Value

NSData*

dataForProperty:defaultValue:

Get the given byte array property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
NSData* defaultValue

Return Value

NSData*

dateAtIndex:

Get the given Date property

Arguments

NSUInteger index

Return Value

NSDate*

dateAtIndex:defaultValue:

Get the given Date property, or the default if it doesn't exist.

Arguments

NSUInteger index
NSDate* defaultValue

Return Value

NSDate*

dateForProperty:

Get the given Date property

Arguments

NSString* propertyExpression

Return Value

NSDate*

dateForProperty:defaultValue:

Get the given Date property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
NSDate* defaultValue

Return Value

NSDate*

doubleAtIndex:

Get the given double property

Arguments

NSUInteger index

Return Value

double

doubleAtIndex:defaultValue:

Get the given double property, or the default if it doesn't exist.

Arguments

NSUInteger index
double defaultValue

Return Value

double

doubleForProperty:

Get the given double property

Arguments

NSString* propertyExpression

Return Value

double

doubleForProperty:defaultValue:

Get the given double property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
double defaultValue

Return Value

double

floatAtIndex:

Get the given float property

Arguments

NSUInteger index

Return Value

float

floatAtIndex:defaultValue:

Get the given float property, or the default if it doesn't exist.

Arguments

NSUInteger index
float defaultValue

Return Value

float

floatForProperty:

Get the given float property

Arguments

NSString* propertyExpression

Return Value

float

floatForProperty:defaultValue:

Get the given float property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
float defaultValue

Return Value

float

insertArray:atIndex:

Insert the given database array at the specified index of the database array

Arguments

PIODatabaseArray* value
NSUInteger index

Return Value

PIODatabaseArray*

insertBool:atIndex:

Insert the given boolean value at the specified index of the database array

Arguments

BOOL value
NSUInteger index

Return Value

PIODatabaseArray*

insertData:atIndex:

Insert the given NSData value at the specified index of the database array

Arguments

NSData* value
NSUInteger index

Return Value

PIODatabaseArray*

insertDate:atIndex:

Insert the given NSDate value at the specified index of the database array

Arguments

NSDate* value
NSUInteger index

Return Value

PIODatabaseArray*

insertDouble:atIndex:

Insert the given double value at the specified index of the database array

Arguments

double value
NSUInteger index

Return Value

PIODatabaseArray*

insertFloat:atIndex:

Insert the given float value at the specified index of the database array

Arguments

float value
NSUInteger index

Return Value

PIODatabaseArray*

insertInt:atIndex:

Insert the given int value at the specified index of the database array

Arguments

int32_t value
NSUInteger index

Return Value

PIODatabaseArray*

insertLong:atIndex:

Insert the given long value at the specified index of the database array

Arguments

int64_t value
NSUInteger index

Return Value

PIODatabaseArray*

insertObject:atIndex:

Insert the given database object at the specified index of the database array

Arguments

PIODatabaseObject* value
NSUInteger index

Return Value

PIODatabaseArray*

insertString:atIndex:

Insert the given string value at the specified index of the database array

Arguments

NSString* value
NSUInteger index

Return Value

PIODatabaseArray*

insertUInt:atIndex:

Insert the given unsigned integer value at the specified index of the database array

Arguments

uint32_t value
NSUInteger index

Return Value

PIODatabaseArray*

intAtIndex:

Get the given int property

Arguments

NSUInteger index

Return Value

int32_t

intAtIndex:defaultValue:

Get the given int property, or the default if it doesn't exist.

Arguments

NSUInteger index
int32_t defaultValue

Return Value

int32_t

intForProperty:

Get the given int property

Arguments

NSString* propertyExpression

Return Value

int32_t

intForProperty:defaultValue:

Get the given int property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
int32_t defaultValue

Return Value

int32_t

keyEnumerator

Enumerator to move over all keys (indexes used) in the array

Return Value

NSEnumerator*

longAtIndex:

Get the given long long property

Arguments

NSUInteger index

Return Value

int64_t

longAtIndex:defaultValue:

Get the given long property, or the default if it doesn't exist.

Arguments

NSUInteger index
int64_t defaultValue

Return Value

int64_t

longForProperty:

Get the given long property

Arguments

NSString* propertyExpression

Return Value

int64_t

longForProperty:defaultValue:

Get the given long property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
int64_t defaultValue

Return Value

int64_t

objectAtIndex:

Get the given DatabaseObject property

Arguments

NSUInteger index

Return Value

PIODatabaseObject*

objectEnumerator

Enumerator to move over all objects in the array

Return Value

NSEnumerator*

objectForProperty:

Get the given DatabaseObject property

Arguments

NSString* propertyExpression

Return Value

PIODatabaseObject*

removeAllObjects

Removes all properties on this array

removeObjectAtIndex:

Removes the given entry from this array

Arguments

NSUInteger index

Return Value

PIODatabaseArray*

setArray:atIndex:

Set the array entry too the given DatabaseArray value

Arguments

PIODatabaseArray* value
NSUInteger index

Return Value

PIODatabaseArray*

setArray:forProperty:

Set the specified property to the given DatabaseArray value

Arguments

PIODatabaseArray* value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setBool:atIndex:

Set the array entry too the given boolean value

Arguments

BOOL value
NSUInteger index

Return Value

PIODatabaseArray*

setBool:forProperty:

Set the specified property to the given boolean value

Arguments

BOOL value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setData:atIndex:

Set the array entry to the given bye array value

Arguments

NSData* value
NSUInteger index

Return Value

PIODatabaseArray*

setData:forProperty:

Set the specified property to the given bye array value

Arguments

NSData* value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setDate:atIndex:

Set the array entry to the given Date value

Arguments

NSDate* value
NSUInteger index

Return Value

PIODatabaseArray*

setDate:forProperty:

Set the specified property to the given Date value

Arguments

NSDate* value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setDouble:atIndex:

Set the array entry to the given double value

Arguments

double value
NSUInteger index

Return Value

PIODatabaseArray*

setDouble:forProperty:

Set the specified property to the given double value

Arguments

double value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setFloat:atIndex:

Set the array entry to the given float value

Arguments

float value
NSUInteger index

Return Value

PIODatabaseArray*

setFloat:forProperty:

Set the specified property to the given float value

Arguments

float value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setInt:atIndex:

Set the array entry to the given int value

Arguments

int32_t value
NSUInteger index

Return Value

PIODatabaseArray*

setInt:forProperty:

Set the specified property to the given int value

Arguments

int32_t value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setLong:atIndex:

Set the array entry to the given long value

Arguments

int64_t value
NSUInteger index

Return Value

PIODatabaseArray*

setLong:forProperty:

Set the specified property to the given long value

Arguments

int64_t value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setObject:atIndex:

Set the array entry to the given DatabaseObject value

Arguments

PIODatabaseObject* value
NSUInteger index

Return Value

PIODatabaseArray*

setObject:forProperty:

Set the specified property to the given DatabaseObject value

Arguments

PIODatabaseObject* value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setString:atIndex:

Set the array entry to the given string value

Arguments

NSString* value
NSUInteger index

Return Value

PIODatabaseArray*

setString:forProperty:

Set the specified property to the given string value

Arguments

NSString* value
NSString* propertyExpression

Return Value

PIODatabaseArray*

setUInt:atIndex:

Set the array entry to the given uint value

Arguments

uint32_t value
NSUInteger index

Return Value

PIODatabaseArray*

setUInt:forProperty:

Set the specified property to the given uint value

Arguments

uint32_t value
NSString* propertyExpression

Return Value

PIODatabaseArray*

stringAtIndex:

Get the given String property

Arguments

NSUInteger index

Return Value

NSString*

stringAtIndex:defaultValue:

Get the given String property, or the default if it doesn't exist.

Arguments

NSUInteger index
NSString* defaultValue

Return Value

NSString*

stringForProperty:

Get the given String property

Arguments

NSString* propertyExpression

Return Value

NSString*

stringForProperty:defaultValue:

Get the given String property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
NSString* defaultValue

Return Value

NSString*

uintAtIndex:

Get the given uint property

Arguments

NSUInteger index

Return Value

uint32_t

uintAtIndex:defaultValue:

Get the given uint property, or the default if it doesn't exist.

Arguments

NSUInteger index
uint32_t defaultValue

Return Value

uint32_t

uintForProperty:

Get the given uint property

Arguments

NSString* propertyExpression

Return Value

uint32_t

uintForProperty:defaultValue:

Get the given uint property, or the default if it doesn't exist.

Arguments

NSString* propertyExpression
uint32_t defaultValue

Return Value

uint32_t

valueAtIndex:

Get the given property as an NSObject. Primitive properties (integers, floats, etc.) are wrapped in NSNumber

Arguments

NSUInteger index

Return Value

id

valueForProperty:

Get the given property as an object. Primitive properties (integers, floats, etc.) are wrapped in NSNumber

Arguments

NSString* propertyExpression

Return Value

id