The open source OpenXR runtime
at main 201 lines 4.3 kB view raw
1// Copyright 2020-2021, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3// Author: Rylie Pavlik <rylie.pavlik@collabora.com> 4 5#pragma once 6 7#include "ObjectWrapperBase.h" 8 9namespace wrap { 10namespace android::os { 11class ParcelFileDescriptor; 12} // namespace android::os 13 14} // namespace wrap 15 16namespace wrap { 17namespace android::os { 18/*! 19 * Wrapper for android.os.BaseBundle objects. 20 */ 21class BaseBundle : public ObjectWrapperBase { 22 public: 23 using ObjectWrapperBase::ObjectWrapperBase; 24 static constexpr const char *getTypeName() noexcept { 25 return "android/os/BaseBundle"; 26 } 27 28 /*! 29 * Wrapper for the containsKey method 30 * 31 * Java prototype: 32 * `public boolean containsKey(java.lang.String);` 33 * 34 * JNI signature: (Ljava/lang/String;)Z 35 * 36 */ 37 bool containsKey(std::string const &key); 38 39 /*! 40 * Wrapper for the getString method 41 * 42 * Java prototype: 43 * `public java.lang.String getString(java.lang.String);` 44 * 45 * JNI signature: (Ljava/lang/String;)Ljava/lang/String; 46 * 47 */ 48 std::string getString(std::string const &key); 49 50 /*! 51 * Wrapper for the getString method 52 * 53 * Java prototype: 54 * `public java.lang.String getString(java.lang.String, java.lang.String);` 55 * 56 * JNI signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; 57 * 58 */ 59 std::string getString(std::string const &key, 60 std::string const &defaultValue); 61 62 /*! 63 * Class metadata 64 */ 65 struct Meta : public MetaBaseDroppable { 66 jni::method_t containsKey; 67 jni::method_t getString; 68 jni::method_t getString1; 69 70 /*! 71 * Singleton accessor 72 */ 73 static Meta &data() { 74 static Meta instance{}; 75 return instance; 76 } 77 78 private: 79 Meta(); 80 }; 81}; 82 83/*! 84 * Wrapper for android.os.Bundle objects. 85 */ 86class Bundle : public BaseBundle { 87 public: 88 using BaseBundle::BaseBundle; 89 static constexpr const char *getTypeName() noexcept { 90 return "android/os/Bundle"; 91 } 92 93 /*! 94 * Class metadata 95 */ 96 struct Meta : public MetaBaseDroppable { 97 98 /*! 99 * Singleton accessor 100 */ 101 static Meta &data() { 102 static Meta instance{}; 103 return instance; 104 } 105 106 private: 107 Meta(); 108 }; 109}; 110 111/*! 112 * Wrapper for android.os.ParcelFileDescriptor objects. 113 */ 114class ParcelFileDescriptor : public ObjectWrapperBase { 115 public: 116 using ObjectWrapperBase::ObjectWrapperBase; 117 static constexpr const char *getTypeName() noexcept { 118 return "android/os/ParcelFileDescriptor"; 119 } 120 121 /*! 122 * Wrapper for the adoptFd static method 123 * 124 * Java prototype: 125 * `public static android.os.ParcelFileDescriptor adoptFd(int);` 126 * 127 * JNI signature: (I)Landroid/os/ParcelFileDescriptor; 128 * 129 */ 130 static ParcelFileDescriptor adoptFd(int fd); 131 132 /*! 133 * Wrapper for the getFd method 134 * 135 * Java prototype: 136 * `public int getFd();` 137 * 138 * JNI signature: ()I 139 * 140 */ 141 int getFd() const; 142 143 /*! 144 * Wrapper for the detachFd method 145 * 146 * Java prototype: 147 * `public int detachFd();` 148 * 149 * JNI signature: ()I 150 * 151 */ 152 int detachFd(); 153 154 /*! 155 * Wrapper for the close method 156 * 157 * Java prototype: 158 * `public void close() throws java.io.IOException;` 159 * 160 * JNI signature: ()V 161 * 162 */ 163 void close(); 164 165 /*! 166 * Wrapper for the checkError method 167 * 168 * Java prototype: 169 * `public void checkError() throws java.io.IOException;` 170 * 171 * JNI signature: ()V 172 * 173 */ 174 void checkError() const; 175 176 /*! 177 * Class metadata 178 */ 179 struct Meta : public MetaBaseDroppable { 180 jni::method_t adoptFd; 181 jni::method_t getFd; 182 jni::method_t detachFd; 183 jni::method_t close; 184 jni::method_t checkError; 185 186 /*! 187 * Singleton accessor 188 */ 189 static Meta &data() { 190 static Meta instance{}; 191 return instance; 192 } 193 194 private: 195 Meta(); 196 }; 197}; 198 199} // namespace android::os 200} // namespace wrap 201#include "android.os.impl.h"