ObjectBox C and C++ API  0.21.0
obx::internal Namespace Reference

Functions

void throwIllegalArgumentException (const char *text1, const char *text2)
 
void throwIllegalStateException (const char *text1, const char *text2)
 
void throwLastError (obx_err err=obx_last_error_code(), const char *contextPrefix=nullptr)
 
void appendLastErrorText (obx_err err, std::string &outMessage)
 
void throwError (obx_err err, const std::string &message)
 
void checkErrOrThrow (obx_err err)
 
bool checkSuccessOrThrow (obx_err err)
 
void checkPtrOrThrow (const void *ptr, const char *contextPrefix=nullptr)
 
void checkIdOrThrow (uint64_t id, const char *contextPrefix=nullptr)
 
template<typename T >
T * checkedPtrOrThrow (T *ptr, const char *contextPrefix=nullptr)
 "Pass-through" variant of checkPtrOrThrow() - prefer the latter if this is not required (less templating). More...
 
template<typename EX = IllegalStateException, typename T >
T & toRef (T *ptr, const char *message="Can not dereference a null pointer")
 Dereferences the given pointer, which must be non-null. More...
 
const OBX_id_array cIdArrayRef (const std::vector< obx_id > &ids)
 Produces an OBX_id_array with internal data referencing the given ids vector. You must ensure the given vector outlives the returned OBX_id_array. Additionally, you must NOT call obx_id_array_free(), because the result is not allocated by C, thus it must not free it. More...
 
std::vector< obx_ididVectorOrThrow (OBX_id_array *cIds)
 Consumes an OBX_id_array, producing a vector of IDs and freeing the array afterwards. Must be called right after the C-API call producing cIds in order to check and throw on error correctly. Example: idVectorOrThrow(obx_query_find_ids(cQuery_, offset_, limit_)) Note: even if this function throws the given OBX_id_array is freed. More...
 
flatbuffers::FlatBufferBuilder & threadLocalFbbDirty ()
 Not cleared, thus potentially "dirty" fbb. More...
 
void threadLocalFbbDone ()
 
TreePutResult mapErrorToTreePutResult (obx_err err)
 

Function Documentation

◆ appendLastErrorText()

void obx::internal::appendLastErrorText ( obx_err  err,
std::string &  outMessage 
)

◆ checkedPtrOrThrow()

template<typename T >
T* obx::internal::checkedPtrOrThrow ( T *  ptr,
const char *  contextPrefix = nullptr 
)

"Pass-through" variant of checkPtrOrThrow() - prefer the latter if this is not required (less templating).

◆ checkErrOrThrow()

void obx::internal::checkErrOrThrow ( obx_err  err)

◆ checkIdOrThrow()

void obx::internal::checkIdOrThrow ( uint64_t  id,
const char *  contextPrefix = nullptr 
)

◆ checkPtrOrThrow()

void obx::internal::checkPtrOrThrow ( const void *  ptr,
const char *  contextPrefix = nullptr 
)

◆ checkSuccessOrThrow()

bool obx::internal::checkSuccessOrThrow ( obx_err  err)

◆ cIdArrayRef()

const OBX_id_array obx::internal::cIdArrayRef ( const std::vector< obx_id > &  ids)

Produces an OBX_id_array with internal data referencing the given ids vector. You must ensure the given vector outlives the returned OBX_id_array. Additionally, you must NOT call obx_id_array_free(), because the result is not allocated by C, thus it must not free it.

◆ idVectorOrThrow()

std::vector<obx_id> obx::internal::idVectorOrThrow ( OBX_id_array cIds)

Consumes an OBX_id_array, producing a vector of IDs and freeing the array afterwards. Must be called right after the C-API call producing cIds in order to check and throw on error correctly. Example: idVectorOrThrow(obx_query_find_ids(cQuery_, offset_, limit_)) Note: even if this function throws the given OBX_id_array is freed.

◆ mapErrorToTreePutResult()

TreePutResult obx::internal::mapErrorToTreePutResult ( obx_err  err)

◆ threadLocalFbbDirty()

flatbuffers::FlatBufferBuilder& obx::internal::threadLocalFbbDirty ( )

Not cleared, thus potentially "dirty" fbb.

◆ threadLocalFbbDone()

void obx::internal::threadLocalFbbDone ( )
inline

◆ throwError()

void obx::internal::throwError ( obx_err  err,
const std::string &  message 
)
Exceptions
Exceptionor subclass depending on the given err, with the given message

◆ throwIllegalArgumentException()

void obx::internal::throwIllegalArgumentException ( const char *  text1,
const char *  text2 
)

◆ throwIllegalStateException()

void obx::internal::throwIllegalStateException ( const char *  text1,
const char *  text2 
)

◆ throwLastError()

void obx::internal::throwLastError ( obx_err  err = obx_last_error_code(),
const char *  contextPrefix = nullptr 
)
Exceptions
Exceptionusing the given error (defaults to obx_last_error_code())

◆ toRef()

template<typename EX = IllegalStateException, typename T >
T& obx::internal::toRef ( T *  ptr,
const char *  message = "Can not dereference a null pointer" 
)

Dereferences the given pointer, which must be non-null.

Exceptions
IllegalStateExceptionif ptr is nullptr