blob: 69d7747471a86d6e3edfa9662ad732b57045dadd (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef MBGL_TEXT_GLYPH_PBF
#define MBGL_TEXT_GLYPH_PBF
#include <mbgl/text/glyph.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <atomic>
#include <functional>
#include <string>
#include <memory>
namespace mbgl {
class GlyphStore;
class FontStack;
class FileRequest;
class GlyphPBF : private util::noncopyable {
public:
class Observer {
public:
virtual ~Observer() = default;
virtual void onGlyphPBFLoaded() = 0;
virtual void onGlyphPBFLoadingFailed(std::exception_ptr error) = 0;
};
GlyphPBF(GlyphStore* store,
const std::string& fontStack,
const GlyphRange& glyphRange);
virtual ~GlyphPBF();
bool isParsed() const {
return parsed;
};
void setObserver(Observer* observer);
private:
void emitGlyphPBFLoaded();
void emitGlyphPBFLoadingFailed(const std::string& message);
void parse(GlyphStore* store, const std::string& fontStack, const std::string& url);
std::shared_ptr<const std::string> data;
std::atomic<bool> parsed;
std::unique_ptr<FileRequest> req;
Observer* observer = nullptr;
};
}
#endif
|