OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 jobject GetObjectField(JNIEnv* jni, jobject object, jfieldID id); | 65 jobject GetObjectField(JNIEnv* jni, jobject object, jfieldID id); |
66 | 66 |
67 jstring GetStringField(JNIEnv* jni, jobject object, jfieldID id); | 67 jstring GetStringField(JNIEnv* jni, jobject object, jfieldID id); |
68 | 68 |
69 jlong GetLongField(JNIEnv* jni, jobject object, jfieldID id); | 69 jlong GetLongField(JNIEnv* jni, jobject object, jfieldID id); |
70 | 70 |
71 jint GetIntField(JNIEnv* jni, jobject object, jfieldID id); | 71 jint GetIntField(JNIEnv* jni, jobject object, jfieldID id); |
72 | 72 |
73 bool GetBooleanField(JNIEnv* jni, jobject object, jfieldID id); | 73 bool GetBooleanField(JNIEnv* jni, jobject object, jfieldID id); |
74 | 74 |
75 // Java references to "null" can only be distinguished as such in C++ by | 75 // Returns true if |obj| == null in Java. |
76 // creating a local reference, so this helper wraps that logic. | |
77 bool IsNull(JNIEnv* jni, jobject obj); | 76 bool IsNull(JNIEnv* jni, jobject obj); |
78 | 77 |
79 // Given a UTF-8 encoded |native| string return a new (UTF-16) jstring. | 78 // Given a UTF-8 encoded |native| string return a new (UTF-16) jstring. |
80 jstring JavaStringFromStdString(JNIEnv* jni, const std::string& native); | 79 jstring JavaStringFromStdString(JNIEnv* jni, const std::string& native); |
81 | 80 |
82 // Given a (UTF-16) jstring return a new UTF-8 native string. | 81 // Given a (UTF-16) jstring return a new UTF-8 native string. |
83 std::string JavaToStdString(JNIEnv* jni, const jstring& j_string); | 82 std::string JavaToStdString(JNIEnv* jni, const jstring& j_string); |
84 | 83 |
85 // Return the (singleton) Java Enum object corresponding to |index|; | 84 // Return the (singleton) Java Enum object corresponding to |index|; |
86 jobject JavaEnumFromIndex(JNIEnv* jni, jclass state_class, | 85 jobject JavaEnumFromIndex(JNIEnv* jni, jclass state_class, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 T operator*() const { | 118 T operator*() const { |
120 return obj_; | 119 return obj_; |
121 } | 120 } |
122 private: | 121 private: |
123 T obj_; | 122 T obj_; |
124 }; | 123 }; |
125 | 124 |
126 } // namespace webrtc_jni | 125 } // namespace webrtc_jni |
127 | 126 |
128 #endif // WEBRTC_API_JAVA_JNI_JNI_HELPERS_H_ | 127 #endif // WEBRTC_API_JAVA_JNI_JNI_HELPERS_H_ |
OLD | NEW |