odin-blend2d

Odin bindings to Blend2D
Log | Files | Refs | README | LICENSE

string.odin (3758B)


      1 // This file is part of Blend2D project <https://blend2d.com>
      2 //
      3 // See blend2d.h or LICENSE.md for license and copyright information
      4 // SPDX-License-Identifier: Zlib
      5 package blend2d
      6 
      7 import "core:c"
      8 
      9 when ODIN_OS == .Windows {
     10 	foreign import lib "blend2d.lib"
     11 } else when ODIN_OS == .Darwin {
     12 	foreign import lib "libblend2d.a"
     13 } else when ODIN_OS == .Linux {
     14 	foreign import lib "libblend2d.a"
     15 }
     16 
     17 
     18 //! Byte string [C API].
     19 StringCore :: struct {
     20 	_d: ObjectDetail,
     21 }
     22 
     23 //! \cond INTERNAL
     24 //! Byte string [Impl].
     25 StringImpl :: struct {
     26 	//! String size [in bytes].
     27 	size: c.size_t,
     28 
     29 	//! String data capacity [in bytes].
     30 	capacity: c.size_t,
     31 }
     32 
     33 @(default_calling_convention="c", link_prefix="bl_")
     34 foreign lib {
     35 	//! \endcond
     36 	string_init              :: proc(self: ^StringCore) -> Result ---
     37 	string_init_move         :: proc(self: ^StringCore, other: ^StringCore) -> Result ---
     38 	string_init_weak         :: proc(self: ^StringCore, other: ^StringCore) -> Result ---
     39 	string_init_with_data    :: proc(self: ^StringCore, str: cstring, size: c.size_t) -> Result ---
     40 	string_destroy           :: proc(self: ^StringCore) -> Result ---
     41 	string_reset             :: proc(self: ^StringCore) -> Result ---
     42 	string_get_data          :: proc(self: ^StringCore) -> cstring ---
     43 	string_get_size          :: proc(self: ^StringCore) -> c.size_t ---
     44 	string_get_capacity      :: proc(self: ^StringCore) -> c.size_t ---
     45 	string_clear             :: proc(self: ^StringCore) -> Result ---
     46 	string_shrink            :: proc(self: ^StringCore) -> Result ---
     47 	string_reserve           :: proc(self: ^StringCore, n: c.size_t) -> Result ---
     48 	string_resize            :: proc(self: ^StringCore, n: c.size_t, fill: i8) -> Result ---
     49 	string_make_mutable      :: proc(self: ^StringCore, data_out: ^cstring) -> Result ---
     50 	string_modify_op         :: proc(self: ^StringCore, op: ModifyOp, n: c.size_t, data_out: ^cstring) -> Result ---
     51 	string_insert_op         :: proc(self: ^StringCore, index: c.size_t, n: c.size_t, data_out: ^cstring) -> Result ---
     52 	string_assign_move       :: proc(self: ^StringCore, other: ^StringCore) -> Result ---
     53 	string_assign_weak       :: proc(self: ^StringCore, other: ^StringCore) -> Result ---
     54 	string_assign_deep       :: proc(self: ^StringCore, other: ^StringCore) -> Result ---
     55 	string_assign_data       :: proc(self: ^StringCore, str: cstring, n: c.size_t) -> Result ---
     56 	string_apply_op_char     :: proc(self: ^StringCore, op: ModifyOp, _c: i8, n: c.size_t) -> Result ---
     57 	string_apply_op_data     :: proc(self: ^StringCore, op: ModifyOp, str: cstring, n: c.size_t) -> Result ---
     58 	string_apply_op_string   :: proc(self: ^StringCore, op: ModifyOp, other: ^StringCore) -> Result ---
     59 	string_apply_op_format   :: proc(self: ^StringCore, op: ModifyOp, fmt: cstring, #c_vararg _: ..any) -> Result ---
     60 	string_apply_op_format_v :: proc(self: ^StringCore, op: ModifyOp, fmt: cstring, ap: i32) -> Result ---
     61 	string_insert_char       :: proc(self: ^StringCore, index: c.size_t, _c: i8, n: c.size_t) -> Result ---
     62 	string_insert_data       :: proc(self: ^StringCore, index: c.size_t, str: cstring, n: c.size_t) -> Result ---
     63 	string_insert_string     :: proc(self: ^StringCore, index: c.size_t, other: ^StringCore) -> Result ---
     64 	string_remove_index      :: proc(self: ^StringCore, index: c.size_t) -> Result ---
     65 	string_remove_range      :: proc(self: ^StringCore, r_start: c.size_t, r_end: c.size_t) -> Result ---
     66 	string_equals            :: proc(a: ^StringCore, b: ^StringCore) -> i32 ---
     67 	string_equals_data       :: proc(self: ^StringCore, str: cstring, n: c.size_t) -> i32 ---
     68 	string_compare           :: proc(a: ^StringCore, b: ^StringCore) -> i32 ---
     69 	string_compare_data      :: proc(self: ^StringCore, str: cstring, n: c.size_t) -> i32 ---
     70 }
     71