summaryrefslogtreecommitdiff
path: root/thirdparty/openxr/src/common/unique_asset.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-14 07:31:54 +0200
committerGitHub <noreply@github.com>2022-09-14 07:31:54 +0200
commitb1e54ef20b1f8bd6c89978b08ffd47d062554cd8 (patch)
treeaeff107d8097f7677a44373a8373b92bb09d670e /thirdparty/openxr/src/common/unique_asset.h
parent2d9583fa3bf2426dabbdd9e9d9b8fd9725b9436c (diff)
parent70d3935bf951c3e081faca02dd56d4f53d0c0a4f (diff)
Merge pull request #65766 from BastiaanOlij/openxr_1_0_25
Update OpenXR to 1.0.25
Diffstat (limited to 'thirdparty/openxr/src/common/unique_asset.h')
-rw-r--r--thirdparty/openxr/src/common/unique_asset.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/thirdparty/openxr/src/common/unique_asset.h b/thirdparty/openxr/src/common/unique_asset.h
new file mode 100644
index 0000000000..4929039a03
--- /dev/null
+++ b/thirdparty/openxr/src/common/unique_asset.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2017-2022, The Khronos Group Inc.
+//
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+#pragma once
+
+#ifdef XR_USE_PLATFORM_ANDROID
+
+#include <memory>
+#include <android/asset_manager.h>
+
+namespace deleters {
+struct AAssetDeleter {
+ void operator()(AAsset* asset) const noexcept {
+ if (asset != nullptr) {
+ AAsset_close(asset);
+ }
+ }
+};
+
+struct AAssetDirDeleter {
+ void operator()(AAssetDir* dir) const noexcept {
+ if (dir != nullptr) {
+ AAssetDir_close(dir);
+ }
+ }
+};
+
+} // namespace deleters
+
+using UniqueAsset = std::unique_ptr<AAsset, deleters::AAssetDeleter>;
+using UniqueAssetDir = std::unique_ptr<AAssetDir, deleters::AAssetDirDeleter>;
+
+#endif