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