/src/harfbuzz/src/hb-blob.hh
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright © 2009 Red Hat, Inc. |
3 | | * Copyright © 2018 Google, Inc. |
4 | | * |
5 | | * This is part of HarfBuzz, a text shaping library. |
6 | | * |
7 | | * Permission is hereby granted, without written agreement and without |
8 | | * license or royalty fees, to use, copy, modify, and distribute this |
9 | | * software and its documentation for any purpose, provided that the |
10 | | * above copyright notice and the following two paragraphs appear in |
11 | | * all copies of this software. |
12 | | * |
13 | | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
14 | | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
15 | | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
16 | | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
17 | | * DAMAGE. |
18 | | * |
19 | | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
20 | | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
21 | | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
22 | | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
23 | | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
24 | | * |
25 | | * Red Hat Author(s): Behdad Esfahbod |
26 | | * Google Author(s): Behdad Esfahbod |
27 | | */ |
28 | | |
29 | | #ifndef HB_BLOB_HH |
30 | | #define HB_BLOB_HH |
31 | | |
32 | | #include "hb.hh" |
33 | | |
34 | | |
35 | | /* |
36 | | * hb_blob_t |
37 | | */ |
38 | | |
39 | | struct hb_blob_t |
40 | | { |
41 | 56 | ~hb_blob_t () { destroy_user_data (); } |
42 | | |
43 | | void destroy_user_data () |
44 | 56 | { |
45 | 56 | if (destroy) |
46 | 56 | { |
47 | 56 | destroy (user_data); |
48 | 56 | user_data = nullptr; |
49 | 56 | destroy = nullptr; |
50 | 56 | } |
51 | 56 | } |
52 | | |
53 | | HB_INTERNAL bool try_make_writable (); |
54 | | HB_INTERNAL bool try_make_writable_inplace (); |
55 | | HB_INTERNAL bool try_make_writable_inplace_unix (); |
56 | | |
57 | 821k | hb_bytes_t as_bytes () const { return hb_bytes_t (data, length); } |
58 | | template <typename Type> |
59 | 821k | const Type* as () const { return as_bytes ().as<Type> (); } Unexecuted instantiation: OT::OpenTypeFontFile const* hb_blob_t::as<OT::OpenTypeFontFile>() const Unexecuted instantiation: OT::cmap const* hb_blob_t::as<OT::cmap>() const Unexecuted instantiation: OT::OS2 const* hb_blob_t::as<OT::OS2>() const Unexecuted instantiation: OT::MVAR const* hb_blob_t::as<OT::MVAR>() const Unexecuted instantiation: OT::fvar const* hb_blob_t::as<OT::fvar>() const Unexecuted instantiation: OT::avar const* hb_blob_t::as<OT::avar>() const Unexecuted instantiation: OT::hhea const* hb_blob_t::as<OT::hhea>() const Unexecuted instantiation: OT::vhea const* hb_blob_t::as<OT::vhea>() const OT::maxp const* hb_blob_t::as<OT::maxp>() const Line | Count | Source | 59 | 18 | const Type* as () const { return as_bytes ().as<Type> (); } |
Unexecuted instantiation: OT::gvar const* hb_blob_t::as<OT::gvar>() const Unexecuted instantiation: OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> const* hb_blob_t::as<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >() const Unexecuted instantiation: OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> const* hb_blob_t::as<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >() const Unexecuted instantiation: OT::head const* hb_blob_t::as<OT::head>() const Unexecuted instantiation: OT::loca const* hb_blob_t::as<OT::loca>() const Unexecuted instantiation: OT::glyf const* hb_blob_t::as<OT::glyf>() const Unexecuted instantiation: OT::cff1 const* hb_blob_t::as<OT::cff1>() const Unexecuted instantiation: OT::cff2 const* hb_blob_t::as<OT::cff2>() const OT::GDEF const* hb_blob_t::as<OT::GDEF>() const Line | Count | Source | 59 | 409k | const Type* as () const { return as_bytes ().as<Type> (); } |
OT::Layout::GPOS const* hb_blob_t::as<OT::Layout::GPOS>() const Line | Count | Source | 59 | 205k | const Type* as () const { return as_bytes ().as<Type> (); } |
Unexecuted instantiation: OT::meta const* hb_blob_t::as<OT::meta>() const Unexecuted instantiation: AAT::ltag const* hb_blob_t::as<AAT::ltag>() const Unexecuted instantiation: OT::name const* hb_blob_t::as<OT::name>() const Unexecuted instantiation: OT::post const* hb_blob_t::as<OT::post>() const Unexecuted instantiation: OT::CBLC const* hb_blob_t::as<OT::CBLC>() const Unexecuted instantiation: OT::CBDT const* hb_blob_t::as<OT::CBDT>() const Unexecuted instantiation: OT::sbix const* hb_blob_t::as<OT::sbix>() const Unexecuted instantiation: OT::sbix::accelerator_t::PNGHeader const* hb_blob_t::as<OT::sbix::accelerator_t::PNGHeader>() const Unexecuted instantiation: OT::SVG const* hb_blob_t::as<OT::SVG>() const OT::Layout::GSUB const* hb_blob_t::as<OT::Layout::GSUB>() const Line | Count | Source | 59 | 205k | const Type* as () const { return as_bytes ().as<Type> (); } |
Unexecuted instantiation: OT::HVAR const* hb_blob_t::as<OT::HVAR>() const Unexecuted instantiation: OT::VVAR const* hb_blob_t::as<OT::VVAR>() const Unexecuted instantiation: OT::VORG const* hb_blob_t::as<OT::VORG>() const Unexecuted instantiation: OT::COLR const* hb_blob_t::as<OT::COLR>() const AAT::morx const* hb_blob_t::as<AAT::morx>() const Line | Count | Source | 59 | 20 | const Type* as () const { return as_bytes ().as<Type> (); } |
AAT::mort const* hb_blob_t::as<AAT::mort>() const Line | Count | Source | 59 | 20 | const Type* as () const { return as_bytes ().as<Type> (); } |
AAT::kerx const* hb_blob_t::as<AAT::kerx>() const Line | Count | Source | 59 | 20 | const Type* as () const { return as_bytes ().as<Type> (); } |
Unexecuted instantiation: AAT::ankr const* hb_blob_t::as<AAT::ankr>() const AAT::trak const* hb_blob_t::as<AAT::trak>() const Line | Count | Source | 59 | 20 | const Type* as () const { return as_bytes ().as<Type> (); } |
Unexecuted instantiation: AAT::feat const* hb_blob_t::as<AAT::feat>() const Unexecuted instantiation: OT::CPAL const* hb_blob_t::as<OT::CPAL>() const OT::kern const* hb_blob_t::as<OT::kern>() const Line | Count | Source | 59 | 30 | const Type* as () const { return as_bytes ().as<Type> (); } |
Unexecuted instantiation: OT::BASE const* hb_blob_t::as<OT::BASE>() const |
60 | | |
61 | | public: |
62 | | hb_object_header_t header; |
63 | | |
64 | | const char *data = nullptr; |
65 | | unsigned int length = 0; |
66 | | hb_memory_mode_t mode = (hb_memory_mode_t) 0; |
67 | | |
68 | | void *user_data = nullptr; |
69 | | hb_destroy_func_t destroy = nullptr; |
70 | | }; |
71 | | |
72 | | |
73 | | /* |
74 | | * hb_blob_ptr_t |
75 | | */ |
76 | | |
77 | | template <typename P> |
78 | | struct hb_blob_ptr_t |
79 | | { |
80 | | typedef hb_remove_pointer<P> T; |
81 | | |
82 | 54 | hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {} Unexecuted instantiation: hb_blob_ptr_t<OT::cmap>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::loca>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::glyf>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::SVG>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::CBLC>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::sbix>::hb_blob_ptr_t(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::post>::hb_blob_ptr_t(hb_blob_t*) hb_blob_ptr_t<OT::GDEF>::hb_blob_ptr_t(hb_blob_t*) Line | Count | Source | 82 | 18 | hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {} |
hb_blob_ptr_t<OT::Layout::GSUB>::hb_blob_ptr_t(hb_blob_t*) Line | Count | Source | 82 | 18 | hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {} |
hb_blob_ptr_t<OT::Layout::GPOS>::hb_blob_ptr_t(hb_blob_t*) Line | Count | Source | 82 | 18 | hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {} |
|
83 | 54 | hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; } Unexecuted instantiation: hb_blob_ptr_t<OT::cmap>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::loca>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::glyf>::operator=(hb_blob_t*) hb_blob_ptr_t<OT::GDEF>::operator=(hb_blob_t*) Line | Count | Source | 83 | 18 | hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; } |
hb_blob_ptr_t<OT::Layout::GPOS>::operator=(hb_blob_t*) Line | Count | Source | 83 | 18 | hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; } |
Unexecuted instantiation: hb_blob_ptr_t<OT::meta>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::name>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::post>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::CBLC>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::sbix>::operator=(hb_blob_t*) Unexecuted instantiation: hb_blob_ptr_t<OT::SVG>::operator=(hb_blob_t*) hb_blob_ptr_t<OT::Layout::GSUB>::operator=(hb_blob_t*) Line | Count | Source | 83 | 18 | hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; } |
Unexecuted instantiation: hb_blob_ptr_t<OT::COLR>::operator=(hb_blob_t*) |
84 | 451 | const T * operator -> () const { return get (); } Unexecuted instantiation: hb_blob_ptr_t<OT::cmap>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::loca>::operator->() const hb_blob_ptr_t<OT::GDEF>::operator->() const Line | Count | Source | 84 | 334 | const T * operator -> () const { return get (); } |
hb_blob_ptr_t<OT::Layout::GPOS>::operator->() const Line | Count | Source | 84 | 59 | const T * operator -> () const { return get (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::meta>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::name>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::post>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBLC>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::sbix>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::SVG>::operator->() const hb_blob_ptr_t<OT::Layout::GSUB>::operator->() const Line | Count | Source | 84 | 58 | const T * operator -> () const { return get (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::operator->() const Unexecuted instantiation: hb_blob_ptr_t<OT::COLR>::operator->() const |
85 | 820k | const T & operator * () const { return *get (); } hb_blob_ptr_t<OT::GDEF>::operator*() const Line | Count | Source | 85 | 409k | const T & operator * () const { return *get (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::operator*() const Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::operator*() const hb_blob_ptr_t<OT::Layout::GSUB>::operator*() const Line | Count | Source | 85 | 205k | const T & operator * () const { return *get (); } |
hb_blob_ptr_t<OT::Layout::GPOS>::operator*() const Line | Count | Source | 85 | 205k | const T & operator * () const { return *get (); } |
|
86 | 9 | template <typename C> operator const C * () const { return get (); } Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::operator void const*<void>() const Unexecuted instantiation: hb_blob_ptr_t<OT::name>::operator void const*<void>() const Unexecuted instantiation: hb_blob_ptr_t<OT::post>::operator void const*<void>() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBLC>::operator void const*<void>() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::operator void const*<void>() const hb_blob_ptr_t<OT::GDEF>::operator OT::GDEF const*<OT::GDEF>() const Line | Count | Source | 86 | 9 | template <typename C> operator const C * () const { return get (); } |
|
87 | 0 | operator const char * () const { return (const char *) get (); } |
88 | 820k | const T * get () const { return b->as<T> (); } Unexecuted instantiation: hb_blob_ptr_t<OT::cmap>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::loca>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::glyf>::get() const hb_blob_ptr_t<OT::GDEF>::get() const Line | Count | Source | 88 | 409k | const T * get () const { return b->as<T> (); } |
hb_blob_ptr_t<OT::Layout::GPOS>::get() const Line | Count | Source | 88 | 205k | const T * get () const { return b->as<T> (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::meta>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::name>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::post>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBLC>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::sbix>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::SVG>::get() const hb_blob_ptr_t<OT::Layout::GSUB>::get() const Line | Count | Source | 88 | 205k | const T * get () const { return b->as<T> (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::get() const Unexecuted instantiation: hb_blob_ptr_t<OT::COLR>::get() const |
89 | 350 | hb_blob_t * get_blob () const { return b.get_raw (); } Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::get_blob() const hb_blob_ptr_t<OT::GDEF>::get_blob() const Line | Count | Source | 89 | 314 | hb_blob_t * get_blob () const { return b.get_raw (); } |
hb_blob_ptr_t<OT::Layout::GPOS>::get_blob() const Line | Count | Source | 89 | 18 | hb_blob_t * get_blob () const { return b.get_raw (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::meta>::get_blob() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::get_blob() const Unexecuted instantiation: hb_blob_ptr_t<OT::sbix>::get_blob() const Unexecuted instantiation: hb_blob_ptr_t<OT::SVG>::get_blob() const hb_blob_ptr_t<OT::Layout::GSUB>::get_blob() const Line | Count | Source | 89 | 18 | hb_blob_t * get_blob () const { return b.get_raw (); } |
Unexecuted instantiation: hb_blob_ptr_t<OT::COLR>::get_blob() const |
90 | 36 | unsigned int get_length () const { return b.get ()->length; } Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::loca>::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::glyf>::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::name>::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::post>::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::get_length() const Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::get_length() const hb_blob_ptr_t<OT::Layout::GSUB>::get_length() const Line | Count | Source | 90 | 18 | unsigned int get_length () const { return b.get ()->length; } |
hb_blob_ptr_t<OT::Layout::GPOS>::get_length() const Line | Count | Source | 90 | 18 | unsigned int get_length () const { return b.get ()->length; } |
|
91 | 54 | void destroy () { hb_blob_destroy (b.get_raw ()); b = nullptr; } Unexecuted instantiation: hb_blob_ptr_t<OT::cmap>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::hmtx, OT::hhea, OT::HVAR> >::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::HVAR>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::post>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::name>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::meta>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::hmtxvmtx<OT::vmtx, OT::vhea, OT::VVAR> >::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::VVAR>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::glyf>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::gvar>::destroy() hb_blob_ptr_t<OT::GDEF>::destroy() Line | Count | Source | 91 | 18 | void destroy () { hb_blob_destroy (b.get_raw ()); b = nullptr; } |
hb_blob_ptr_t<OT::Layout::GSUB>::destroy() Line | Count | Source | 91 | 18 | void destroy () { hb_blob_destroy (b.get_raw ()); b = nullptr; } |
hb_blob_ptr_t<OT::Layout::GPOS>::destroy() Line | Count | Source | 91 | 18 | void destroy () { hb_blob_destroy (b.get_raw ()); b = nullptr; } |
Unexecuted instantiation: hb_blob_ptr_t<OT::CBLC>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::CBDT>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::sbix>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::SVG>::destroy() Unexecuted instantiation: hb_blob_ptr_t<OT::COLR>::destroy() |
92 | | |
93 | | private: |
94 | | hb_nonnull_ptr_t<hb_blob_t> b; |
95 | | }; |
96 | | |
97 | | |
98 | | #endif /* HB_BLOB_HH */ |