Delta Chat Core C-API
Public Member Functions | List of all members
dc_array_t Class Reference

An object containing a simple array. More...

#include <deltachat.h>

Public Member Functions

double dc_array_get_accuracy (const dc_array_t *array, size_t index)
 Return the accuracy of the item at the given index. More...
 
uint32_t dc_array_get_chat_id (const dc_array_t *array, size_t index)
 Return the chat-id of the item at the given index. More...
 
size_t dc_array_get_cnt (const dc_array_t *array)
 Find out the number of items in an array. More...
 
uint32_t dc_array_get_contact_id (const dc_array_t *array, size_t index)
 Return the contact-id of the item at the given index. More...
 
uint32_t dc_array_get_id (const dc_array_t *array, size_t index)
 Get the item at the given index as an ID. More...
 
double dc_array_get_latitude (const dc_array_t *array, size_t index)
 Return the latitude of the item at the given index. More...
 
double dc_array_get_longitude (const dc_array_t *array, size_t index)
 Return the longitude of the item at the given index. More...
 
char * dc_array_get_marker (const dc_array_t *array, size_t index)
 Return the marker-character of the item at the given index. More...
 
uint32_t dc_array_get_msg_id (const dc_array_t *array, size_t index)
 Return the message-id of the item at the given index. More...
 
void * dc_array_get_ptr (const dc_array_t *array, size_t index)
 Get the item at the given index as an ID. More...
 
const uintptr_t * dc_array_get_raw (const dc_array_t *array)
 Get raw pointer to the data. More...
 
time_t dc_array_get_timestamp (const dc_array_t *array, size_t index)
 Return the timestamp of the item at the given index. More...
 
uintptr_t dc_array_get_uint (const dc_array_t *array, size_t index)
 Get the item at the given index as an unsigned integer. More...
 
void dc_array_unref (dc_array_t *array)
 Free an array object. More...
 

Detailed Description

An object containing a simple array.

This object is used in several places where functions need to return an array. The items of the array are typically IDs. To free an array object, use dc_array_unref().

Member Function Documentation

◆ dc_array_get_accuracy()

double dc_array_get_accuracy ( const dc_array_t array,
size_t  index 
)

Return the accuracy of the item at the given index.

See dc_set_location() for more information about the accuracy.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Accuracy of the item at the given index. 0.0 if there is no longitude bound to the given item,

◆ dc_array_get_chat_id()

uint32_t dc_array_get_chat_id ( const dc_array_t array,
size_t  index 
)

Return the chat-id of the item at the given index.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Chat-id of the item at the given index. 0 if there is no chat-id bound to the given item,

◆ dc_array_get_cnt()

size_t dc_array_get_cnt ( const dc_array_t array)

Find out the number of items in an array.

Parameters
arrayThe array object.
Returns
Returns the number of items in a dc_array_t object. 0 on errors or if the array is empty.

◆ dc_array_get_contact_id()

uint32_t dc_array_get_contact_id ( const dc_array_t array,
size_t  index 
)

Return the contact-id of the item at the given index.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Contact-id of the item at the given index. 0 if there is no contact-id bound to the given item,

◆ dc_array_get_id()

uint32_t dc_array_get_id ( const dc_array_t array,
size_t  index 
)

Get the item at the given index as an ID.

Parameters
arrayThe array object.
indexIndex of the item to get. Must be between 0 and dc_array_get_cnt()-1.
Returns
Returns the item at the given index. Returns 0 on errors or if the array is empty.

◆ dc_array_get_latitude()

double dc_array_get_latitude ( const dc_array_t array,
size_t  index 
)

Return the latitude of the item at the given index.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Latitude of the item at the given index. 0.0 if there is no latitude bound to the given item,

◆ dc_array_get_longitude()

double dc_array_get_longitude ( const dc_array_t array,
size_t  index 
)

Return the longitude of the item at the given index.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Latitude of the item at the given index. 0.0 if there is no longitude bound to the given item,

◆ dc_array_get_marker()

char * dc_array_get_marker ( const dc_array_t array,
size_t  index 
)

Return the marker-character of the item at the given index.

Marker-character are typically bound to locations returned by dc_get_locations() and are typically created by on-character-messages which can also be an emoticon :)

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Marker-character of the item at the given index. NULL if there is no marker-character bound to the given item. The returned value must be free()'d after usage.

◆ dc_array_get_msg_id()

uint32_t dc_array_get_msg_id ( const dc_array_t array,
size_t  index 
)

Return the message-id of the item at the given index.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Message-id of the item at the given index. 0 if there is no message-id bound to the given item,

◆ dc_array_get_ptr()

void * dc_array_get_ptr ( const dc_array_t array,
size_t  index 
)

Get the item at the given index as an ID.

Parameters
arrayThe array object.
indexIndex of the item to get. Must be between 0 and dc_array_get_cnt()-1.
Returns
Returns the item at the given index. Returns 0 on errors or if the array is empty.

◆ dc_array_get_raw()

const uintptr_t * dc_array_get_raw ( const dc_array_t array)

Get raw pointer to the data.

Parameters
arrayThe array object.
Returns
Raw pointer to the array. You MUST NOT free the data. You MUST NOT access the data beyond the current item count. It is not possible to enlarge the array this way. Calling any other dc_array*()-function may discard the returned pointer.

◆ dc_array_get_timestamp()

time_t dc_array_get_timestamp ( const dc_array_t array,
size_t  index 
)

Return the timestamp of the item at the given index.

Parameters
arrayThe array object.
indexIndex of the item. Must be between 0 and dc_array_get_cnt()-1.
Returns
Timestamp of the item at the given index. 0 if there is no timestamp bound to the given item,

◆ dc_array_get_uint()

uintptr_t dc_array_get_uint ( const dc_array_t array,
size_t  index 
)

Get the item at the given index as an unsigned integer.

The size of the integer is always larget enough to hold a pointer.

Parameters
arrayThe array object.
indexIndex of the item to get. Must be between 0 and dc_array_get_cnt()-1.
Returns
Returns the item at the given index. Returns 0 on errors or if the array is empty.

◆ dc_array_unref()

void dc_array_unref ( dc_array_t array)

Free an array object.

Does not free any data items.

Parameters
arrayThe array object to free, created eg. by dc_get_chatlist(), dc_get_contacts() and so on. If NULL is given, nothing is done.
Returns
None.

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