1 /++ 2 + Machine generated D bindings for Sokol library. 3 + 4 + Generated on: 2025-07-06 12:35:39 5 + 6 + Source header: sokol_args.h 7 + Module: sokol.args 8 + 9 + Do not edit manually; regenerate using gen_d.py. 10 +/ 11 module sokol.args; 12 13 /++ 14 + sargs_allocator 15 + 16 + Used in sargs_desc to provide custom memory-alloc and -free functions 17 + to sokol_args.h. If memory management should be overridden, both the 18 + alloc_fn and free_fn function must be provided (e.g. it's not valid to 19 + override one function but not the other). 20 +/ 21 extern(C) struct Allocator { 22 extern(C) void* function(size_t, void*) alloc_fn = null; 23 extern(C) void function(void*, void*) free_fn = null; 24 void* user_data = null; 25 } 26 extern(C) struct Desc { 27 int argc = 0; 28 void* argv; 29 int max_args = 0; 30 int buf_size = 0; 31 Allocator allocator = {}; 32 } 33 /++ 34 + setup sokol-args 35 +/ 36 extern(C) void sargs_setup(const Desc* desc) @system @nogc nothrow pure; 37 void setup(scope ref Desc desc) @trusted @nogc nothrow pure { 38 sargs_setup(&desc); 39 } 40 /++ 41 + shutdown sokol-args 42 +/ 43 extern(C) void sargs_shutdown() @system @nogc nothrow pure; 44 void shutdown() @trusted @nogc nothrow pure { 45 sargs_shutdown(); 46 } 47 /++ 48 + true between sargs_setup() and sargs_shutdown() 49 +/ 50 extern(C) bool sargs_isvalid() @system @nogc nothrow pure; 51 bool isvalid() @trusted @nogc nothrow pure { 52 return sargs_isvalid(); 53 } 54 /++ 55 + test if an argument exists by key name 56 +/ 57 extern(C) bool sargs_exists(const(char)* key) @system @nogc nothrow pure; 58 bool exists(const(char)* key) @trusted @nogc nothrow pure { 59 return sargs_exists(key); 60 } 61 /++ 62 + get value by key name, return empty string if key doesn't exist or an existing key has no value 63 +/ 64 extern(C) const(char)* sargs_value(const(char)* key) @system @nogc nothrow pure; 65 const(char)* value(const(char)* key) @trusted @nogc nothrow pure { 66 return sargs_value(key); 67 } 68 /++ 69 + get value by key name, return provided default if key doesn't exist or has no value 70 +/ 71 extern(C) const(char)* sargs_value_def(const(char)* key, const(char)* def) @system @nogc nothrow pure; 72 const(char)* valueDef(const(char)* key, const(char)* def) @trusted @nogc nothrow pure { 73 return sargs_value_def(key, def); 74 } 75 /++ 76 + return true if val arg matches the value associated with key 77 +/ 78 extern(C) bool sargs_equals(const(char)* key, const(char)* val) @system @nogc nothrow pure; 79 bool equals(const(char)* key, const(char)* val) @trusted @nogc nothrow pure { 80 return sargs_equals(key, val); 81 } 82 /++ 83 + return true if key's value is "true", "yes", "on" or an existing key has no value 84 +/ 85 extern(C) bool sargs_boolean(const(char)* key) @system @nogc nothrow pure; 86 bool boolean(const(char)* key) @trusted @nogc nothrow pure { 87 return sargs_boolean(key); 88 } 89 /++ 90 + get index of arg by key name, return -1 if not exists 91 +/ 92 extern(C) int sargs_find(const(char)* key) @system @nogc nothrow pure; 93 int find(const(char)* key) @trusted @nogc nothrow pure { 94 return sargs_find(key); 95 } 96 /++ 97 + get number of parsed arguments 98 +/ 99 extern(C) int sargs_num_args() @system @nogc nothrow pure; 100 int numArgs() @trusted @nogc nothrow pure { 101 return sargs_num_args(); 102 } 103 /++ 104 + get key name of argument at index, or empty string 105 +/ 106 extern(C) const(char)* sargs_key_at(int index) @system @nogc nothrow pure; 107 const(char)* keyAt(int index) @trusted @nogc nothrow pure { 108 return sargs_key_at(index); 109 } 110 /++ 111 + get value string of argument at index, or empty string 112 +/ 113 extern(C) const(char)* sargs_value_at(int index) @system @nogc nothrow pure; 114 const(char)* valueAt(int index) @trusted @nogc nothrow pure { 115 return sargs_value_at(index); 116 }