| 22 | return HANDLE_AS_BUNDLE(handle)->optInt32(key, *out); |
| 23 | } |
| 24 | bool 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 | |
| 41 | void tt_bundle_put_bool(BundleHandle handle, const char* key, bool value) { |
| 42 | HANDLE_AS_BUNDLE(handle)->putBool(key, value); |