Report abuse


			
// By pumpkin

typedef void *CPRecordRef;

typedef struct CPRecordClass {
  char *name;
  int unk0;
  int unk1;
  int unk2;
  void *deletefn;
  int unk3;
  void *beforesavefn;
  int unk4;
  void *nameforpropertyfn;
  int property_count;
  void *properties;
  int unk6;
} *CPRecordClassRef;

typedef struct CPRecordProperty {
  char *name;
  int unk0;
  CPRecordPropertyCallbacksRef callbacks;
  int unk2;
  int unk3;
} *CPRecordPropertyRef;

typedef struct CPRecordPropertyCallbacks {
  CPRecordRef (*createCopy)(CPRecordRef);
  void (*destroy)(CPRecordRef);
  void (*show)(CPRecordRef);
  void * (*load)(CPRecordRef, int);
  int (*save)(CPRecordRef, int, void *);
} *CPRecordPropertyCallbacksRef;

CPRecordCopyProperty

// Creates a new record of the given class
CPRecordRef CPRecordCreate(void *class);

// Frees the memory associated with the specified record
void CPRecordDestroy(CPRecordRef record);

CPRecordGetCachedProperty

// Returns the class of the specified record
void *CPRecordGetClass(CPRecordRef record);

// Returns the records ID
int CPRecordGetID(CPRecordRef record);

// Returns the value of the specified property
void *CPRecordGetProperty(CPRecordRef record, int index);

CPRecordGetPropertyDescriptor

// Returns the CPRecordStore that this record came from
CPRecordStoreRef CPRecordGetStore(CPRecordRef record);

// Returns the index of the specified property name (this prototype is wrong)
int CPRecordIndexOfPropertyNamed(CPRecordRef record, int count, char *name);

CPRecordInitializeProperty

// Marks a record as changed
int CPRecordMarkChanged(CPRecordRef record);

// Sets a property in the specified record
int CPRecordSetProperty(CPRecordRef record, int index, void *value);

// Shows the specified record
void CPRecordShow(CPRecordRef record);

// Clears the cache of a record's property
int CPRecordUnloadProperty(CPRecordRef record, int index);



CPSqliteDatabaseCreateWithPath

// Sets the ClientVersion key on the database (stored in the _SqliteDatabaseProperties table, in the database)
int CPSqliteDatabaseSetVersion(CPSQliteDatabaseRef database, int version);

CPSqliteDatabaseSetSetupHandler

// Returns the path for the given database
CFStringRef CPSqliteDatabasePath(CPSqliteDatabaseRef database);


_CPSqliteCreateDatabaseConnectionForWriting
CPSqliteDatabaseReleaseSqliteConnection
CPSqliteConnectionRowidOfLastInsert
CPSqliteStatementStringResult
CPSqliteStatementIntegerResult
CPSqliteStatementFinalize
CPSqliteStatementApplyValuesFromRecord
CPSqliteComparePhoneNumbers
CPSqlitePhoneNumberContainsAlphaCharacters
CPSqliteNormalizePhoneNumber

// Frees the given statement
int CPSqliteStatementReset(CPSqliteStatementRef statement);

// Performs the given statement
int CPSqliteStatementPerform(CPSqliteStatementRef statement);

CPSqliteDatabaseDefaultSetupHandler

// Creates a Statement object for the given sql on the provided connection
CPSqliteStatementRef CPSqliteConnectionStatementForSQL(CPSqliteConnectionRef connection, CFStringRef sql);

CPSqliteCompareSortKeyPrefixes
CPSqliteHasSortKeyPrefix
CPSqliteDatabaseReleaseSqliteStatement
CPSqliteStatementProcessPhoneQuery

// Closes the specified database
int CPSqliteDatabaseClose(CPSqliteDatabaseRef database);

CPSqliteDatabaseCloseAllConnections

CPSqliteConnectionSetValueForProperty
CPSqliteConnectionPerformSQL

CPSqliteConnectionRollback
CPSqliteConnectionCommit
CPSqliteConnectionBegin

CPSqliteConnectionAddRecord
CPSqliteConnectionUpdateRecord
CPSqliteConnectionCopyValueForProperty

CPSqliteConnectionIntegerForProperty
CPSqliteConnectionSetIntegerForProperty

CPSqliteDatabaseConnectionForWriting
CPSqliteDatabaseSetLoggingEnabled

// Registers a custom sqlite function with the database
int CPSqliteDatabaseRegisterFunction(CPSqliteDatabaseRef database, char *name, void *function, int parameterCount);

CPSqliteDatabaseSetValueForProperty
CPSqliteDatabaseStatementForWriting
CPSqliteDatabaseConnectionForReading
CPSqliteDatabaseCopyValueForProperty
CPSqliteDatabaseStatementForReading
CPSqliteDatabaseCopyUniqueIdentifier
CPSqliteStatementSendResults

// Sets a context (arbitrary user data pointer) for the given record store
int CPRecordStoreSetContext(CPRecordStoreRef store, void *context);

// Returns the context associated with the given record store
void *CPRecordStoreGetContext(CPRecordStoreRef store);


int CPRecordStoreSetValueForProperty(void *value, CFStringRef property);

// Creates a record store with the given path
CPRecordStoreRef CPRecordStoreCreateWithPath(CFStringRef path);

// Sets a callback that should be called when the database needs to be initialized (TODO: give a stronger type to the function pointer)
int CPRecordStoreSetSetupHandler(CPRecordStoreRef store, void *handler);

// Returns the sqlite backing database for the given record store
CPSqliteDatabaseRef CPRecordStoreGetDatabase(CPRecordStoreRef store);

CPRecordStoreGetCache
CPRecordStoreGetDeletedRecords
CPRecordStoreSaveProperty
CPRecordStoreDeleteRecord
CPRecordStoreDeleteRecordsInDictionary
_CPRecordStoreSaveAddedRecords

// Logs the changes (the flush parameter is a guess)
int CPRecordStoreLogChanges(CPRecordStoreRef store, BOOL flush);

CPRecordStoreIsLoggingChanges
CPRecordStoreDestroy
CPRecordStoreCreateTablesForClass
CPRecordStoreRegisterClass
CPRecordStoreCreateSelectPrefixFromRecordDescriptorWithAdditionalColumns
CPRecordStoreCreateSelectPrefixFromRecordDescriptorWithAdditionalColumn
CPRecordStoreCreateSelectPrefixFromRecordDescriptor
CPRecordStoreProcessStatement
CPRecordStoreAddRecord
CPRecordStoreRemoveRecordInternal
CPRecordStoreRemoveRecord
CPRecordStoreRemoveRecordOfClassWithUID
CPRecordStoreInvalidateCachedInstancesOfClass
CPRecordStoreWriteColumnsForRecord
CPRecordStoreSaveRecord
CPRecordStoreUpdateRecord
CPRecordStoreCopyValueForProperty
CPRecordStoreProcessAddedRecords
CPRecordStoreProcessAddedRecordsOfClass
CPRecordStoreSaveWithCallback
CPRecordStoreSave
CPRecordStoreInvalidateCaches
CPRecordStoreProcessQuery
CPRecordStoreLoadInstancesOfClassWhere
CPRecordStoreCopyAllInstancesOfClass
CPRecordStoreGetInstanceOfClassWithUID
CPRecordStoreGetInstancesOfClassWithUIDs
CPRecordStoreGetChangesForClass
CPRecordStoreDeleteChangesForClassToIndex
CPRecordStoreGetCountOfAllInstancesOfClass