summaryrefslogtreecommitdiff
path: root/platform/android/src/file_source.hpp
blob: 8bc463904712e181261cbf79557e1ffe9618e737 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include <mbgl/storage/default_file_source.hpp>

#include <jni/jni.hpp>

namespace mbgl {
namespace android {

/**
 * Peer class for the Android FileSource holder. Ensures that a single DefaultFileSource is used
 */
class FileSource {
public:

    static constexpr auto Name() { return "com/mapbox/mapboxsdk/fs/FileSource"; };

    FileSource(jni::JNIEnv&, jni::String, jni::String);

    ~FileSource();

    static jni::Class<FileSource> javaClass;

    static FileSource* getNativePeer(jni::JNIEnv&, jni::Object<FileSource>);

    static mbgl::DefaultFileSource& getDefaultFileSource(jni::JNIEnv&, jni::Object<FileSource>);

    static void registerNative(jni::JNIEnv&);

private:

    std::unique_ptr<mbgl::DefaultFileSource> fileSource;
};


} // namespace android
} // namespace mbgl