summaryrefslogtreecommitdiff
path: root/platform/android/src/style/value.hpp
blob: 2057b9345473c6bd69679d06b1aa564a6402c523 (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
38
39
40
41
#pragma once

#include <jni/jni.hpp>

#include <string>

namespace mbgl {
namespace android {

class Value {
public:
    Value(jni::JNIEnv&, jni::jobject*);

    Value(Value&&)                 = default;
    Value& operator=(Value&&)      = default;

    Value(const Value&)            = delete;
    Value& operator=(const Value&) = delete;

    bool isNull() const;
    bool isArray() const;
    bool isObject() const;
    bool isString() const;
    bool isBool() const;
    bool isNumber() const;

    std::string toString() const;
    float toFloat() const;
    double toDouble() const;
    long toLong() const;
    bool toBool() const;
    Value get(const char* key) const;
    int getLength() const;
    Value get(const int index ) const;

    jni::JNIEnv& env;
    std::shared_ptr<jni::jobject> value;
};

}
}