summaryrefslogtreecommitdiff
path: root/src/mbgl/text/glyph_pbf.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/text/glyph_pbf.hpp')
-rw-r--r--src/mbgl/text/glyph_pbf.hpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/mbgl/text/glyph_pbf.hpp b/src/mbgl/text/glyph_pbf.hpp
new file mode 100644
index 0000000000..bb6fa83ae6
--- /dev/null
+++ b/src/mbgl/text/glyph_pbf.hpp
@@ -0,0 +1,52 @@
+#ifndef MBGL_TEXT_GLYPH_PBF
+#define MBGL_TEXT_GLYPH_PBF
+
+#include <mbgl/text/glyph.hpp>
+
+#include <functional>
+#include <atomic>
+#include <string>
+
+namespace mbgl {
+
+class Environment;
+class FontStack;
+class Request;
+
+class GlyphPBF {
+public:
+ using GlyphLoadedCallback = std::function<void(GlyphPBF*)>;
+ using GlyphLoadingFailedCallback = std::function<void(const std::string&)>;
+
+ GlyphPBF(const std::string &glyphURL,
+ const std::string &fontStack,
+ GlyphRange glyphRange,
+ Environment &env,
+ const GlyphLoadedCallback& successCallback,
+ const GlyphLoadingFailedCallback& failureCallback);
+ ~GlyphPBF();
+
+ void parse(FontStack &stack);
+ bool isParsed() const;
+
+ std::string getURL() const {
+ return url;
+ }
+
+private:
+ GlyphPBF(const GlyphPBF &) = delete;
+ GlyphPBF(GlyphPBF &&) = delete;
+ GlyphPBF &operator=(const GlyphPBF &) = delete;
+ GlyphPBF &operator=(GlyphPBF &&) = delete;
+
+ std::string data;
+ std::string url;
+ std::atomic<bool> parsed;
+
+ Environment& env;
+ Request* req = nullptr;
+};
+
+} // end namespace mbgl
+
+#endif