MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mbgl::util Namespace Reference

Namespaces

 non_copyable_
 

Classes

class  AsyncTask
 
class  CharArrayBuffer
 
class  DefaultStyle
 
struct  Exception
 
struct  StyleImageException
 
struct  MisuseException
 
struct  StyleParseException
 
struct  StyleLoadException
 
struct  NotFoundException
 
struct  Interpolator
 
struct  Interpolator< float >
 
struct  Interpolator< std::array< T, N > >
 
struct  Interpolator< std::array< float, N > >
 
struct  Interpolator< std::vector< style::expression::Value > >
 
struct  Interpolator< style::Position >
 
struct  Interpolator< Color >
 
struct  Interpolator< style::Rotation >
 
struct  Uninterpolated
 
struct  Interpolator< bool >
 
struct  Interpolator< T, typename std::enable_if_t< std::is_enum_v< T > > >
 
struct  Interpolator< std::string >
 
struct  Interpolator< std::vector< T > >
 
struct  Interpolatable
 
class  MonotonicTimer
 
class  RunLoop
 
class  Thread
 Manages a thread with Object. More...
 
class  Timer
 
struct  UnitBezier
 

Typedefs

using noncopyable = non_copyable_::noncopyable
 
using LOOP_HANDLE = void *
 

Enumerations

enum  CompressionFormat { ZLIB = 15 , GZIP = 15 + 16 , DEFLATE = -15 , DETECT = 15 + 32 }
 

Functions

constexpr double deg2rad (double deg) noexcept
 Converts degrees to radians. More...
 
constexpr float deg2radf (float deg) noexcept
 Converts degrees to radians. More...
 
constexpr double rad2deg (double rad) noexcept
 Converts radians to degrees. More...
 
constexpr float rad2degf (float rad) noexcept
 Converts radians to degrees. More...
 
template<typename T >
clamp (T value, T min_, T max_)
 
uint32_t ceil_log2 (uint64_t x)
 
template<typename T >
log2 (T x)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, T > max (T a, T b)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > max (T a, T b)
 
template<typename T , typename... Ts>
std::enable_if_t< std::is_arithmetic_v< T >, T > max (T a, T b, Ts... args)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, T > min (T a, T b)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > min (T a, T b)
 
template<typename T , typename... Ts>
std::enable_if_t< std::is_arithmetic_v< T >, T > min (T a, T b, Ts... args)
 
template<typename T >
wrap (T value, T min, T max)
 
std::string toString (const CanonicalTileID &)
 
std::string toString (const OverscaledTileID &)
 
std::string toString (const UnwrappedTileID &)
 
Timestamp now ()
 
std::string rfc1123 (Timestamp)
 
std::string iso8601 (Timestamp)
 
Timestamp parseTimestamp (const char *)
 
Timestamp parseTimestamp (int32_t timestamp)
 
std::string compress (const std::string &raw, int windowBits=CompressionFormat::ZLIB)
 
std::string decompress (const std::string &raw, int windowBits=CompressionFormat::DETECT)
 
template<typename To , typename From , std::size_t Size, typename = std::enable_if_t<std::is_convertible_v<From, To>>>
MBGL_CONSTEXPR std::array< To, Sizeconvert (const std::array< From, Size > &from)
 
template<class... Ts>
void ignore (Ts &&...)
 
template<class T >
void ignore (const std::initializer_list< T > &)
 
void ignore (const std::initializer_list< int > &)
 
float interpolationFactor (float base, Range< float > range, float z)
 
template<typename T >
interpolate (const T &a, const T &b, const double t)
 
template<typename T >
interpolate (const T &a, const T &b, const float t)
 
PremultipliedImage premultiply (UnassociatedImage &&)
 
UnassociatedImage unpremultiply (PremultipliedImage &&)
 
std::string toString (int64_t)
 
std::string toString (uint64_t)
 
std::string toString (int32_t)
 
std::string toString (uint32_t)
 
std::string toString (double, bool decimal=false)
 
std::string toString (int16_t t)
 
std::string toString (uint16_t t)
 
std::string toString (int8_t t)
 
std::string toString (uint8_t t)
 
template<typename = std::enable_if<!std::is_same_v<uint64_t, unsigned long>>>
std::string toString (unsigned long t)
 
template<typename = std::enable_if<!std::is_same_v<uint64_t, unsigned long long>>>
std::string toString (unsigned long long t)
 
template<typename = std::enable_if<!std::is_same_v<int64_t, long>>>
std::string toString (long t)
 
template<typename = std::enable_if<!std::is_same_v<int64_t, long long>>>
std::string toString (long long t)
 
std::string toString (float t, bool decimal=false)
 
std::string toString (long double t, bool decimal=false)
 
std::string toString (const std::exception_ptr &)
 
template<class T >
std::string toString (T)=delete
 
std::string toHex (uint32_t)
 
std::string toHex (uint64_t)
 
float stof (const std::string &str)
 
std::function< void()> makeThreadPrioritySetter (std::string threadType)
 

Variables

constexpr double tileSize_D = 512
 
constexpr uint16_t tileSize_I = 512
 
constexpr int32_t EXTENT = 8192
 
constexpr double M2PI = M_PI * 2
 
constexpr double EARTH_RADIUS_M = 6378137
 
constexpr double LATITUDE_MAX = 85.051128779806604
 
constexpr double LONGITUDE_MAX = 180
 
constexpr double DEGREES_MAX = 360
 
constexpr double PITCH_MIN = 0.0
 
constexpr double PITCH_MAX = M_PI / 3
 
constexpr double MIN_ZOOM = 0.0
 
constexpr double MAX_ZOOM = 25.5
 
constexpr float MIN_ZOOM_F = MIN_ZOOM
 
constexpr float MAX_ZOOM_F = MAX_ZOOM
 
constexpr uint8_t DEFAULT_MAX_ZOOM = 22
 
constexpr float ONE_EM = 24.0f
 
constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA = 4
 
constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024
 
constexpr std::size_t DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE = 100 * 8192
 
constexpr Duration DEFAULT_TRANSITION_DURATION = Milliseconds(300)
 
constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT { 30 }
 
constexpr UnitBezier DEFAULT_TRANSITION_EASE = { 0, 0, 0.25, 1 }
 
constexpr int DEFAULT_RATE_LIMIT_TIMEOUT = 5
 
constexpr const char * ASSET_PROTOCOL = "asset://"
 
constexpr const char * FILE_PROTOCOL = "file://"
 
constexpr const char * MBTILES_PROTOCOL = "mbtiles://"
 
constexpr uint32_t DEFAULT_MAXIMUM_CONCURRENT_REQUESTS = 20
 
constexpr uint8_t TERRAIN_RGB_MAXZOOM = 15
 
constexpr const char * LAST_RESORT_ALPHABETIC_FONT = "Open Sans Regular"
 
constexpr const char * LAST_RESORT_PAN_UNICODE_FONT = "Arial Unicode MS Regular"
 

Typedef Documentation

◆ LOOP_HANDLE

using mbgl::util::LOOP_HANDLE = typedef void *

Definition at line 19 of file run_loop.hpp.

◆ noncopyable

Definition at line 20 of file noncopyable.hpp.

Enumeration Type Documentation

◆ CompressionFormat

Enumerator
ZLIB 
GZIP 
DEFLATE 
DETECT 

Definition at line 8 of file compression.hpp.

Function Documentation

◆ ceil_log2()

uint32_t mbgl::util::ceil_log2 ( uint64_t  x)

Computes the log2(x) rounded up to the next integer. (== number of bits required to store x)

◆ clamp()

template<typename T >
T mbgl::util::clamp ( value,
min_,
max_ 
)

Definition at line 9 of file clamp.hpp.

◆ compress()

std::string mbgl::util::compress ( const std::string &  raw,
int  windowBits = CompressionFormat::ZLIB 
)

◆ convert()

template<typename To , typename From , std::size_t Size, typename = std::enable_if_t<std::is_convertible_v<From, To>>>
MBGL_CONSTEXPR std::array<To, Size> mbgl::util::convert ( const std::array< From, Size > &  from)

Definition at line 12 of file convert.hpp.

◆ decompress()

std::string mbgl::util::decompress ( const std::string &  raw,
int  windowBits = CompressionFormat::DETECT 
)

◆ deg2rad()

constexpr double mbgl::util::deg2rad ( double  deg)
constexprnoexcept

Converts degrees to radians.

Parameters
degDegrees as double.
Returns
Radians as double.

Definition at line 14 of file angles.hpp.

◆ deg2radf()

constexpr float mbgl::util::deg2radf ( float  deg)
constexprnoexcept

Converts degrees to radians.

Parameters
degDegrees as float.
Returns
Radians as float.

Definition at line 24 of file angles.hpp.

◆ ignore() [1/3]

void mbgl::util::ignore ( const std::initializer_list< int > &  )
inline

Definition at line 21 of file ignore.hpp.

◆ ignore() [2/3]

template<class T >
void mbgl::util::ignore ( const std::initializer_list< T > &  )

Definition at line 18 of file ignore.hpp.

◆ ignore() [3/3]

template<class... Ts>
void mbgl::util::ignore ( Ts &&  ...)

Accept any number of parameters of any types, and do nothing with them. Useful for providing a context for parameter pack expansion where a legal expansion context is not otherwise available.

See https://github.com/mapbox/cpp/blob/1bb519ef25edd6169f1d6d8a65414044616590a9/docs/structural-metaprogramming.md for more details.

Definition at line 14 of file ignore.hpp.

◆ interpolate() [1/2]

template<typename T >
T mbgl::util::interpolate ( const T &  a,
const T &  b,
const double  t 
)

Definition at line 24 of file interpolate.hpp.

◆ interpolate() [2/2]

template<typename T >
T mbgl::util::interpolate ( const T &  a,
const T &  b,
const float  t 
)

Definition at line 29 of file interpolate.hpp.

◆ interpolationFactor()

float mbgl::util::interpolationFactor ( float  base,
Range< float >  range,
float  z 
)

◆ iso8601()

std::string mbgl::util::iso8601 ( Timestamp  )

◆ log2()

template<typename T >
T mbgl::util::log2 ( x)

Definition at line 19 of file log2.hpp.

◆ makeThreadPrioritySetter()

std::function<void()> mbgl::util::makeThreadPrioritySetter ( std::string  threadType)

Returns function, that once invoked, will set a thread priority for a thread threadType based on a setting provided by corresponding Settings' platform::EXPERIMENTAL_THREAD_PRIORITY_* value.

◆ max() [1/3]

template<typename T >
std::enable_if_t<std::is_integral_v<T>, T> mbgl::util::max ( a,
b 
)

Definition at line 11 of file minmax.hpp.

◆ max() [2/3]

template<typename T >
std::enable_if_t<std::is_floating_point_v<T>, T> mbgl::util::max ( a,
b 
)

Definition at line 16 of file minmax.hpp.

◆ max() [3/3]

template<typename T , typename... Ts>
std::enable_if_t<std::is_arithmetic_v<T>, T> mbgl::util::max ( a,
b,
Ts...  args 
)

Definition at line 21 of file minmax.hpp.

◆ min() [1/3]

template<typename T >
std::enable_if_t<std::is_integral_v<T>, T> mbgl::util::min ( a,
b 
)

Definition at line 26 of file minmax.hpp.

◆ min() [2/3]

template<typename T >
std::enable_if_t<std::is_floating_point_v<T>, T> mbgl::util::min ( a,
b 
)

Definition at line 31 of file minmax.hpp.

◆ min() [3/3]

template<typename T , typename... Ts>
std::enable_if_t<std::is_arithmetic_v<T>, T> mbgl::util::min ( a,
b,
Ts...  args 
)

Definition at line 36 of file minmax.hpp.

◆ now()

Timestamp mbgl::util::now ( )
inline

Definition at line 25 of file chrono.hpp.

◆ parseTimestamp() [1/2]

Timestamp mbgl::util::parseTimestamp ( const char *  )

◆ parseTimestamp() [2/2]

Timestamp mbgl::util::parseTimestamp ( int32_t  timestamp)

◆ premultiply()

PremultipliedImage mbgl::util::premultiply ( UnassociatedImage &&  )

◆ rad2deg()

constexpr double mbgl::util::rad2deg ( double  rad)
constexprnoexcept

Converts radians to degrees.

Parameters
radRadians as double.
Returns
Degrees as double.

Definition at line 34 of file angles.hpp.

◆ rad2degf()

constexpr float mbgl::util::rad2degf ( float  rad)
constexprnoexcept

Converts radians to degrees.

Parameters
radRadians as float.
Returns
Degrees as float.

Definition at line 44 of file angles.hpp.

◆ rfc1123()

std::string mbgl::util::rfc1123 ( Timestamp  )

◆ stof()

float mbgl::util::stof ( const std::string &  str)
inline

Definition at line 88 of file string.hpp.

◆ toHex() [1/2]

std::string mbgl::util::toHex ( uint32_t  )

◆ toHex() [2/2]

std::string mbgl::util::toHex ( uint64_t  )

◆ toString() [1/20]

std::string mbgl::util::toString ( const CanonicalTileID )

◆ toString() [2/20]

std::string mbgl::util::toString ( const OverscaledTileID )

◆ toString() [3/20]

std::string mbgl::util::toString ( const std::exception_ptr &  )

◆ toString() [4/20]

std::string mbgl::util::toString ( const UnwrappedTileID )

◆ toString() [5/20]

std::string mbgl::util::toString ( double  ,
bool  decimal = false 
)

◆ toString() [6/20]

std::string mbgl::util::toString ( float  t,
bool  decimal = false 
)
inline

Definition at line 72 of file string.hpp.

◆ toString() [7/20]

std::string mbgl::util::toString ( int16_t  t)
inline

Definition at line 36 of file string.hpp.

◆ toString() [8/20]

std::string mbgl::util::toString ( int32_t  )

◆ toString() [9/20]

std::string mbgl::util::toString ( int64_t  )

◆ toString() [10/20]

std::string mbgl::util::toString ( int8_t  t)
inline

Definition at line 44 of file string.hpp.

◆ toString() [11/20]

std::string mbgl::util::toString ( long double  t,
bool  decimal = false 
)
inline

Definition at line 76 of file string.hpp.

◆ toString() [12/20]

template<typename = std::enable_if<!std::is_same_v<int64_t, long long>>>
std::string mbgl::util::toString ( long long  t)
inline

Definition at line 68 of file string.hpp.

◆ toString() [13/20]

template<typename = std::enable_if<!std::is_same_v<int64_t, long>>>
std::string mbgl::util::toString ( long  t)
inline

Definition at line 63 of file string.hpp.

◆ toString() [14/20]

template<class T >
std::string mbgl::util::toString ( )
delete

◆ toString() [15/20]

std::string mbgl::util::toString ( uint16_t  t)
inline

Definition at line 40 of file string.hpp.

◆ toString() [16/20]

std::string mbgl::util::toString ( uint32_t  )

◆ toString() [17/20]

std::string mbgl::util::toString ( uint64_t  )

◆ toString() [18/20]

std::string mbgl::util::toString ( uint8_t  t)
inline

Definition at line 48 of file string.hpp.

◆ toString() [19/20]

template<typename = std::enable_if<!std::is_same_v<uint64_t, unsigned long long>>>
std::string mbgl::util::toString ( unsigned long long  t)
inline

Definition at line 58 of file string.hpp.

◆ toString() [20/20]

template<typename = std::enable_if<!std::is_same_v<uint64_t, unsigned long>>>
std::string mbgl::util::toString ( unsigned long  t)
inline

Definition at line 53 of file string.hpp.

◆ unpremultiply()

UnassociatedImage mbgl::util::unpremultiply ( PremultipliedImage &&  )

◆ wrap()

template<typename T >
T mbgl::util::wrap ( value,
min,
max 
)

Constrains n to the given range (including min, excluding max) via modular arithmetic.

Definition at line 11 of file wrap.hpp.

Variable Documentation

◆ ASSET_PROTOCOL

constexpr const char* mbgl::util::ASSET_PROTOCOL = "asset://"
constexpr

Definition at line 60 of file constants.hpp.

◆ CLOCK_SKEW_RETRY_TIMEOUT

constexpr Seconds mbgl::util::CLOCK_SKEW_RETRY_TIMEOUT { 30 }
constexpr

Definition at line 54 of file constants.hpp.

◆ DEFAULT_MAX_CACHE_SIZE

constexpr uint64_t mbgl::util::DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024
constexpr

Definition at line 47 of file constants.hpp.

◆ DEFAULT_MAX_ZOOM

constexpr uint8_t mbgl::util::DEFAULT_MAX_ZOOM = 22
constexpr

Definition at line 40 of file constants.hpp.

◆ DEFAULT_MAXIMUM_CONCURRENT_REQUESTS

constexpr uint32_t mbgl::util::DEFAULT_MAXIMUM_CONCURRENT_REQUESTS = 20
constexpr

Definition at line 63 of file constants.hpp.

◆ DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE

constexpr std::size_t mbgl::util::DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE = 100 * 8192
constexpr

Definition at line 51 of file constants.hpp.

◆ DEFAULT_PREFETCH_ZOOM_DELTA

constexpr uint8_t mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA = 4
constexpr

Definition at line 45 of file constants.hpp.

◆ DEFAULT_RATE_LIMIT_TIMEOUT

constexpr int mbgl::util::DEFAULT_RATE_LIMIT_TIMEOUT = 5
constexpr

Definition at line 58 of file constants.hpp.

◆ DEFAULT_TRANSITION_DURATION

constexpr Duration mbgl::util::DEFAULT_TRANSITION_DURATION = Milliseconds(300)
constexpr

Definition at line 53 of file constants.hpp.

◆ DEFAULT_TRANSITION_EASE

constexpr UnitBezier mbgl::util::DEFAULT_TRANSITION_EASE = { 0, 0, 0.25, 1 }
constexpr

Definition at line 56 of file constants.hpp.

◆ DEGREES_MAX

constexpr double mbgl::util::DEGREES_MAX = 360
constexpr

Definition at line 33 of file constants.hpp.

◆ EARTH_RADIUS_M

constexpr double mbgl::util::EARTH_RADIUS_M = 6378137
constexpr

Definition at line 30 of file constants.hpp.

◆ EXTENT

constexpr int32_t mbgl::util::EXTENT = 8192
constexpr

Definition at line 27 of file constants.hpp.

◆ FILE_PROTOCOL

constexpr const char* mbgl::util::FILE_PROTOCOL = "file://"
constexpr

Definition at line 61 of file constants.hpp.

◆ LAST_RESORT_ALPHABETIC_FONT

constexpr const char* mbgl::util::LAST_RESORT_ALPHABETIC_FONT = "Open Sans Regular"
constexpr

Definition at line 67 of file constants.hpp.

◆ LAST_RESORT_PAN_UNICODE_FONT

constexpr const char* mbgl::util::LAST_RESORT_PAN_UNICODE_FONT = "Arial Unicode MS Regular"
constexpr

Definition at line 68 of file constants.hpp.

◆ LATITUDE_MAX

constexpr double mbgl::util::LATITUDE_MAX = 85.051128779806604
constexpr

Definition at line 31 of file constants.hpp.

◆ LONGITUDE_MAX

constexpr double mbgl::util::LONGITUDE_MAX = 180
constexpr

Definition at line 32 of file constants.hpp.

◆ M2PI

constexpr double mbgl::util::M2PI = M_PI * 2
constexpr

Definition at line 29 of file constants.hpp.

◆ MAX_ZOOM

constexpr double mbgl::util::MAX_ZOOM = 25.5
constexpr

Definition at line 37 of file constants.hpp.

◆ MAX_ZOOM_F

constexpr float mbgl::util::MAX_ZOOM_F = MAX_ZOOM
constexpr

Definition at line 39 of file constants.hpp.

◆ MBTILES_PROTOCOL

constexpr const char* mbgl::util::MBTILES_PROTOCOL = "mbtiles://"
constexpr

Definition at line 62 of file constants.hpp.

◆ MIN_ZOOM

constexpr double mbgl::util::MIN_ZOOM = 0.0
constexpr

Definition at line 36 of file constants.hpp.

◆ MIN_ZOOM_F

constexpr float mbgl::util::MIN_ZOOM_F = MIN_ZOOM
constexpr

Definition at line 38 of file constants.hpp.

◆ ONE_EM

constexpr float mbgl::util::ONE_EM = 24.0f
constexpr

Definition at line 43 of file constants.hpp.

◆ PITCH_MAX

constexpr double mbgl::util::PITCH_MAX = M_PI / 3
constexpr

Definition at line 35 of file constants.hpp.

◆ PITCH_MIN

constexpr double mbgl::util::PITCH_MIN = 0.0
constexpr

Definition at line 34 of file constants.hpp.

◆ TERRAIN_RGB_MAXZOOM

constexpr uint8_t mbgl::util::TERRAIN_RGB_MAXZOOM = 15
constexpr

Definition at line 65 of file constants.hpp.

◆ tileSize_D

constexpr double mbgl::util::tileSize_D = 512
constexpr

Definition at line 13 of file constants.hpp.

◆ tileSize_I

constexpr uint16_t mbgl::util::tileSize_I = 512
constexpr

Definition at line 14 of file constants.hpp.