Android: Add helper function for converting Integer -> rtc::Optional<int>

Bug: webrtc:8278
Change-Id: I1c499a35c5fd77304ed2906ea61ef2322ec98cea
No-Tree-Checks: true
Reviewed-on: https://webrtc-review.googlesource.com/20876
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20750}
This commit is contained in:
Magnus Jedvert
2017-11-18 14:02:59 +01:00
committed by Commit Bot
parent 9b16e2d354
commit cdda0d99a3
13 changed files with 102 additions and 121 deletions

View File

@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include "api/optional.h"
#include "rtc_base/checks.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/refcount.h"
@ -107,6 +108,13 @@ std::string JavaToStdString(JNIEnv* jni, const jstring& j_string);
// return a new vector of UTF-8 native strings.
std::vector<std::string> JavaToStdVectorStrings(JNIEnv* jni, jobject list);
rtc::Optional<int32_t> JavaIntegerToOptionalInt(JNIEnv* jni, jobject integer);
jobject JavaIntegerFromOptionalInt(JNIEnv* jni,
const rtc::Optional<int32_t>& optional_int);
jobject JavaIntegerFromInt(JNIEnv* jni, int32_t i);
// Return the (singleton) Java Enum object corresponding to |index|;
jobject JavaEnumFromIndex(JNIEnv* jni, jclass state_class,
const std::string& state_class_name, int index);