1// Copyright (c) 2017-2023, The Khronos Group Inc.
2//
3// SPDX-License-Identifier: Apache-2.0 OR MIT
4#pragma once
5
6#ifdef XR_USE_PLATFORM_ANDROID
7
8#include <memory>
9#include <android/asset_manager.h>
10
11namespace deleters {
12struct AAssetDeleter {
13 void operator()(AAsset* asset) const noexcept {
14 if (asset != nullptr) {
15 AAsset_close(asset);
16 }
17 }
18};
19
20struct AAssetDirDeleter {
21 void operator()(AAssetDir* dir) const noexcept {
22 if (dir != nullptr) {
23 AAssetDir_close(dir);
24 }
25 }
26};
27
28} // namespace deleters
29
30using UniqueAsset = std::unique_ptr<AAsset, deleters::AAssetDeleter>;
31using UniqueAssetDir = std::unique_ptr<AAssetDir, deleters::AAssetDirDeleter>;
32
33#endif
34