Scanbot SDK
Loading...
Searching...
No Matches
ScanbotSDKTypes.h File Reference

The Scanbot SDK C API primitive types. More...

Go to the source code of this file.

Classes

struct  scanbotsdk_point_t
 Represents a point with integer coordinates. More...
 
struct  scanbotsdk_pointf_t
 Represents a point with floating point coordinates. More...
 
struct  scanbotsdk_rect_t
 Represents a rectangle with integer coordinates. More...
 
struct  scanbotsdk_rectf_t
 Represents a rectangle with floating point coordinates. More...
 
struct  scanbotsdk_u8string_ref_t
 Represents a non-owning view of a UTF-8 encoded string. More...
 

Typedefs

typedef struct scanbotsdk_point_t scanbotsdk_point_t
 Represents a point with integer coordinates.
 
typedef struct scanbotsdk_pointf_t scanbotsdk_pointf_t
 Represents a point with floating point coordinates.
 
typedef struct scanbotsdk_rect_t scanbotsdk_rect_t
 Represents a rectangle with integer coordinates.
 
typedef struct scanbotsdk_rectf_t scanbotsdk_rectf_t
 Represents a rectangle with floating point coordinates.
 
typedef struct scanbotsdk_u8string_ref_t scanbotsdk_u8string_ref_t
 Represents a non-owning view of a UTF-8 encoded string.
 

Functions

SBSDK_API scanbotsdk_u8string_ref_t scanbotsdk_u8string_ref_from_cstring (const char *str)
 Creates a string ref from a null-terminated C string.
 
SBSDK_API const char * scanbotsdk_u8string_ref_assume_cstring (scanbotsdk_u8string_ref_t string_ref)
 Explicitly casts the reference data to a null-terminated C-string.
 

Detailed Description

The Scanbot SDK C API primitive types.

Typedef Documentation

◆ scanbotsdk_u8string_ref_t

typedef struct scanbotsdk_u8string_ref_t scanbotsdk_u8string_ref_t

Represents a non-owning view of a UTF-8 encoded string.

Represents a view onto a byte sequence; the view does not own the underlying memory. Whether the payload is valid UTF-8, and whether a null terminator exists at data[size], are determined entirely by the origin of the reference. This struct makes no guarantee of either on its own.

Input to SDK APIs: When passed as an argument to a Scanbot SDK API, the payload is required to be valid UTF-8. If validation fails, the API returns an error. No assumption is made about data[size]; a null terminator is neither required nor read.

Output from SDK APIs: References returned by Scanbot SDK APIs provide both guarantees unconditionally. The payload is valid UTF-8. The underlying allocation extends to size + 1 bytes, and data[size] is \0.

Function Documentation

◆ scanbotsdk_u8string_ref_assume_cstring()

SBSDK_API const char * scanbotsdk_u8string_ref_assume_cstring ( scanbotsdk_u8string_ref_t string_ref)

Explicitly casts the reference data to a null-terminated C-string.

This function performs no conversions or safety checks; it simply returns the underlying .data pointer. It exists strictly as a semantic marker in the code to indicate that the caller assumes the reference is safely null-terminated.

  • Warning: Because scanbotsdk_u8string_ref_t does not universally guarantee null-termination (e.g., if constructed manually by the user), treating the result of this function as a C-string is unsafe unless you know its origin. Only use this for references returned directly by the SDK, or when you have verified the memory yourself.
  • Parameters
    string_refThe string reference to read.
    Returns
    The underlying .data pointer, explicitly assumed to be a null-terminated C-string.

◆ scanbotsdk_u8string_ref_from_cstring()

SBSDK_API scanbotsdk_u8string_ref_t scanbotsdk_u8string_ref_from_cstring ( const char * str)

Creates a string ref from a null-terminated C string.

Parameters
strThe null-terminated C string to create the ref from.
Returns
A string ref representing the given C string.