MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / tt_bundle_opt_string

Function tt_bundle_opt_string

TactilityC/Source/tt_bundle.cpp:24–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 return HANDLE_AS_BUNDLE(handle)->optInt32(key, *out);
23}
24bool tt_bundle_opt_string(BundleHandle handle, const char* key, char* out, uint32_t outSize) {
25 std::string out_string;
26
27 if (!HANDLE_AS_BUNDLE(handle)->optString(key, out_string)) {
28 return false;
29 }
30
31 if (out_string.length() >= outSize) {
32 // Need 1 byte to add 0 at the end
33 return false;
34 }
35
36 memcpy(out, out_string.c_str(), out_string.length());
37 out[out_string.length()] = 0x00;
38 return true;
39}
40
41void tt_bundle_put_bool(BundleHandle handle, const char* key, bool value) {
42 HANDLE_AS_BUNDLE(handle)->putBool(key, value);

Callers

nothing calls this directly

Calls 1

optStringMethod · 0.45

Tested by

no test coverage detected