MCPcopy Create free account
hub / github.com/Snapchat/Valdi / jniGetMapPropertyAndReturnValue

Function jniGetMapPropertyAndReturnValue

valdi/src/valdi/android/MarshallerJNI.cpp:106–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105template<typename T>
106static std::optional<T> jniGetMapPropertyAndReturnValue(
107 JNIEnv* env, jlong ptr, jlong propPtr, jint index, bool optional) {
108 auto marshaller = unwrap(env, ptr);
109 if (marshaller == nullptr) {
110 return std::nullopt;
111 }
112
113 if (!jniGetMapProperty(env, marshaller, propPtr, index, optional)) {
114 return std::nullopt;
115 }
116
117 auto value = marshaller->getOrUndefined(-1).checkedTo<T>(marshaller->getExceptionTracker());
118 marshaller->pop();
119 if (!checkMarshaller(env, marshaller)) {
120 return std::nullopt;
121 }
122
123 return {std::move(value)};
124}
125
126bool checkNotNull(JNIEnv* env, jobject object) {
127 if (object == nullptr) {

Callers

nothing calls this directly

Calls 5

unwrapFunction · 0.85
jniGetMapPropertyFunction · 0.85
checkMarshallerFunction · 0.85
getOrUndefinedMethod · 0.80
popMethod · 0.65

Tested by

no test coverage detected