1.10
Classes | Typedefs | Enumerations | Functions
egt::v1::detail Namespace Reference

Internal detail namespace. More...

Classes

class  AnimationBase
 Base class for an animation. More...
 
class  ComposerScreen
 Screen in an in-memory buffer for the Microchip Graphic Composer. More...
 
class  CopyOnWriteAllocate
 Copy-On-Write wrapper for an object or container. More...
 
struct  EnumStrings
 When using enum_to_string() and enum_from_string(), this type needs to be defined and specialized to include the data for enum string conversions. More...
 
class  ImageCache
 Internal image cache. More...
 
class  InputEvDev
 Handles reading input events from evdev devices. More...
 
class  InputLibInput
 Handles populating and reading input events from libinput. More...
 
class  InputTslib
 Handles reading input from a tslib supported device. More...
 
class  KMSOverlay
 Screen in a KMS dumb buffer inside of an overlay plane. More...
 
class  KMSScreen
 Screen in an KMS dumb buffer. More...
 
struct  LayoutRect
 Wrapper around properties for managing a rect by flex_layout(). More...
 
class  MemoryScreen
 Screen in an in-memory buffer. More...
 
class  MouseGesture
 Basic class for interpreting mouse events. More...
 
class  NonCopyable
 Utility base class to make a derived class non-copy-able. More...
 
class  Range
 Utility class to allow range loops from a subset of a container. More...
 
class  ReverseRange
 Range class to work with C++11 range based for loops in a reverse order. More...
 
struct  ScopeExit
 Utility to run a callback when this object goes out of scope. More...
 
class  SDLScreen
 Screen in an SDL window. More...
 
class  X11Screen
 Screen in an X11 window. More...
 

Typedefs

using unique_plane_t = std::unique_ptr< plane_data, detail::plane_t_deleter >
 Unique pointer for a cairo context.
 

Enumerations

enum class  Compatible { normal , display , grid }
 Geometry types compatibility type. More...
 
enum class  SchemeType { unknown , resource , filesystem , network }
 URI scheme types. More...
 

Functions

EGT_API std::string abspath (const std::string &path)
 Convert a relative path to an absolute path.
 
EGT_API Rect align_algorithm (const Rect &orig, const Rect &bounding, const AlignFlags &align, DefaultDim padding=0, DefaultDim horizontal_ratio=0, DefaultDim vertical_ratio=0, DefaultDim xratio=0, DefaultDim yratio=0)
 Given an item size, and a bounding box, and an alignment parameter, return the rectangle the item box should be move/resized to.
 
EGT_API Rect align_algorithm_force (const Rect &orig, const Rect &bounding, const AlignFlags &align, DefaultDim padding=0, DefaultDim horizontal_ratio=0, DefaultDim vertical_ratio=0, DefaultDim xratio=0, DefaultDim yratio=0)
 align_algorithm()
 
EGT_API uint32_t align_to_behave (const AlignFlags &align)
 Compute lib lay behave from @align flags.
 
EGT_API bool alpha_collision (const Rect &lhs, cairo_surface_t *limage, const Point &rhs)
 Detect alpha collision with a specific point.
 
EGT_API bool alpha_collision (const Rect &lhs, cairo_surface_t *limage, const Rect &rhs, cairo_surface_t *rimage)
 Detect alpha collision between two images.
 
template<class T >
constexpr T angle_diff (T angle_start, T angle_stop, bool clockwise=true)
 Compute the angle different between two angles.
 
template<class T >
constexpr T bit (T n)
 Utility to create a bit mask for the specified bit.
 
cairo_format_t cairo_format (PixelFormat format)
 Convert a PixelFormat to a cairo format.
 
template<>
constexpr bool change_if_diff (double &old, const double &to)
 
template<>
constexpr bool change_if_diff (float &old, const float &to)
 
template<class T >
constexpr bool change_if_diff (T &old, const T &to)
 Utility to test and change a value if it is different.
 
template<class T >
constexpr const T & clamp (const T &v, const T &lo, const T &hi)
 Clamp a value between a hi and low value.
 
template<class BinaryPredicate , class InputIterator1 , class InputIterator2 >
constexpr bool cmp (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred)
 
EGT_API std::string cwd ()
 Get the current working directory.
 
EGT_API std::string demangle (const char *name)
 Demangle a C++ symbol into something human readable.
 
EGT_API Widgetdragged ()
 Get the current widget which is being dragged, or nullptr.
 
EGT_API void dragged (Widget *widget)
 Set the current widget which is being dragged.
 
uint32_t drm_format (PixelFormat format)
 Convert a pixel format to a DRM format.
 
PixelFormat egt_format (cairo_format_t format)
 Convert a cairo format to a pixel format.
 
PixelFormat egt_format (uint32_t format)
 Convert a DRM format to a pixel format.
 
template<class T >
constexpr T enum_from_string (const char *value)
 Convert a string to an enum value.
 
template<class T >
constexpr T enum_from_string (const std::string &value)
 Convert a string to an enum value.
 
template<class T >
constexpr const char * enum_to_string (T const &e)
 Convert an enum to a string.
 
EGT_API std::string exe_pwd ()
 Get the directory to the current executable.
 
EGT_API bool exists (const std::string &path)
 Determine if a file exists.
 
EGT_API std::string extract_dirname (const std::string &path)
 Extract the directory name from a path.
 
EGT_API std::string extract_filename (const std::string &path)
 Extract the filename portion of a path or URL.
 
template<class T >
constexpr T fabs (T x, typename std::enable_if< std::is_floating_point< T >::value >::type *=nullptr)
 constexpr version of fabs/fabsf
 
EGT_API void flex_layout (const Rect &parent, std::vector< LayoutRect > &children, Justification justify, Orientation orient)
 Perform a manual flex layout given a parent rect and children rects.
 
EGT_API void flex_layout (const Rect &parent, std::vector< LayoutRect > &children, Justification justify, Orientation orient, const AlignFlags &align)
 Perform a manual flex layout with a parent and child rect, but allow a global child alignment with the align parameter.
 
constexpr bool float_equal (const double f1, const double f2)
 Safe equal comparison of double values.
 
constexpr bool float_equal (const float f1, const float f2)
 Safe equal comparison of float values.
 
template<class T >
std::string format (T value, int precision=2)
 Format a float/double to a fixed precision and return as a string.
 
EGT_API bool from_string (const std::string &x)
 Convert a lexical std::string to a bool.
 
EGT_API std::string get_mime_type (const std::string &path)
 Return the mime type string for a file.
 
EGT_API std::string get_mime_type (const void *buffer, size_t length)
 Return the mime type string for a buffer.
 
EGT_API std::vector< std::string > glob (const std::string &pattern)
 Given a glob pattern, return a vector of matching path names.
 
std::string gstreamer_format (PixelFormat format)
 Convert a pixel format to a gstreamer format.
 
constexpr unsigned int hash (const char *str, int h=0)
 Perform a hash of a string.
 
unsigned int hash (const std::string &str)
 Perform a hash of a string.
 
constexpr unsigned int hextoul (const char *str, unsigned int base=16)
 Like, but not the same as strtoul().
 
template<typename T >
void ignoreparam (T &&)
 Utility function to safely ignore a parameter to a function.
 
EGT_API ImageCacheimage_cache ()
 Global image cache instance.
 
template<class Functor , class T >
interpolate (Functor &&easing, T percent, T start, T end, bool reverse=false)
 Interpolate function used internally.
 
template<class T >
void join (std::ostream &os, const T &container, const std::string &delimiter=",")
 Join each item of a container with the specified delimiter between each item.
 
EGT_API uint32_t justify_to_contains (Justification justify, Orientation orient)
 Compute lib lay contains from @justify and @orient parameters.
 
EGT_API Widgetkeyboard_focus ()
 Get the current widget which has the keyboard focus, or nullptr.
 
EGT_API void keyboard_focus (Widget *widget)
 Set the keyboard focus of a widget.
 
EGT_API KeyboardCode linux_to_ekey (int code)
 Map a Linux key code to an EKEY.
 
EGT_API shared_cairo_surface_t load_image_from_filesystem (const std::string &path)
 Load an image from the filesystem.
 
EGT_API shared_cairo_surface_t load_image_from_memory (const unsigned char *data, size_t len, const std::string &name={})
 Load an image from memory.
 
EGT_API shared_cairo_surface_t load_image_from_network (const std::string &url)
 Load an image from the network.
 
EGT_API shared_cairo_surface_t load_image_from_resource (const std::string &name)
 Load an image from ResourceManager.
 
EGT_API std::string ltrim (const std::string &source, const std::string &t=" \t\n\r")
 Trim delimiters off the left side of a std::string.
 
template<class T >
constexpr T mmod (T a, T n)
 Floating point safe modulus function.
 
EGT_API Widgetmouse_grab ()
 Get the current widget which has the mouse grabbed, or nullptr.
 
EGT_API void mouse_grab (Widget *widget)
 Set the current widget to grab the mouse.
 
template<typename InputIt , typename OutputIt >
constexpr OutputIt move (InputIt b, InputIt e, OutputIt to)
 
template<class T >
constexpr T normalize (T value, T min, T max, T target_min, T target_max)
 Normalize a value, given its min and max, to a different target min and max.
 
template<class T >
constexpr T normalize_to_angle (T value, T min, T max, T angle_start, T angle_stop, bool clockwise=true)
 Normalize a value, given its min and max, to a different target angle min and max.
 
template<class T >
ScopeExit< T > on_scope_exit (T &&f)
 Helper to construct a ScopeExit with proper type deduction of the template parameter, which may be a lambda.
 
EGT_API char path_separator ()
 Get the separator character in a list of paths.
 
template<typename T >
constexpr T pi ()
 Returns the value of PI, accurate to the type used.
 
template<typename T >
constexpr T pi_2 ()
 Returns the value of PI/2, accurate to the type used.
 
EGT_API std::vector< unsigned char > read_file (const std::string &path)
 Read the contents of a file into a vector.
 
EGT_API std::string readlink (const std::string &path)
 Read the path of a symlink.
 
EGT_API std::string replace_all (std::string str, const std::string &from, const std::string &to)
 Replace all in string.
 
EGT_API SchemeType resolve_path (const std::string &path, std::string &result)
 Resolves a path to a type and path.
 
template<typename T >
ReverseRange< T > reverse_iterate (T &x)
 Reverse iterator to work with C++11 range based for loops in a reverse order.
 
EGT_API std::string rtrim (const std::string &source, const std::string &t=" \t\n\r")
 Trim delimiters off the right side of a std::string.
 
template<class T >
constexpr bool rule_of_5 ()
 Rule of 5 static assert all in one.
 
template<class T , std::size_t N>
constexpr std::size_t size (const T(&)[N]) noexcept
 Return the size of an array (c++17's std::size()).
 
EGT_API void strip (std::string &str, const std::string &t=" \t\n\r")
 Strip the specified characters from the string.
 
template<class T >
constexpr T to_degrees (T radians)
 Convert from radians to degrees.
 
template<class T >
constexpr T to_radians (T zero, T degrees)
 Convert from degrees to radians.
 
template<>
std::string to_string (const bool &x)
 Convert a bool to a lexical std::string.
 
template<class T >
std::string to_string (const T &x)
 Convert a type to a std::string using std::ostringstream.
 
EGT_API void tokenize (const std::string &str, char delimiter, std::vector< std::string > &tokens)
 Tokenize a std::string.
 
EGT_API void tolower (std::string &s)
 Convert a string to lowercase.
 
EGT_API void toupper (std::string &s)
 Convert a string to lowercase.
 
EGT_API std::string trim (const std::string &source, const std::string &t=" \t\n\r")
 Trim delimiters off both sides of a std::string.
 
EGT_API std::string truncate (const std::string &str, size_t width, bool ellipsis=true)
 Truncate a string if applicable and optionally add ellipse to end.
 

Detailed Description

Internal detail namespace.

The detail namespace is considered unstable and private to EGT. Use at your own risk.

Typedef Documentation

◆ unique_plane_t

using unique_plane_t = std::unique_ptr<plane_data, detail::plane_t_deleter>

Unique pointer for a cairo context.

Enumeration Type Documentation

◆ Compatible

enum class Compatible
strong

Geometry types compatibility type.

This is used to create strong incompatible types as a template argument.

Enumerator
normal 
display 
grid 

◆ SchemeType

enum class SchemeType
strong

URI scheme types.

Enumerator
unknown 
resource 
filesystem 
network 

Function Documentation

◆ abspath()

EGT_API std::string abspath ( const std::string &  path)

Convert a relative path to an absolute path.

This is similar to POSIX.1-2001 realpath().

◆ align_algorithm()

EGT_API Rect align_algorithm ( const Rect orig,
const Rect bounding,
const AlignFlags align,
DefaultDim  padding = 0,
DefaultDim  horizontal_ratio = 0,
DefaultDim  vertical_ratio = 0,
DefaultDim  xratio = 0,
DefaultDim  yratio = 0 
)

Given an item size, and a bounding box, and an alignment parameter, return the rectangle the item box should be move/resized to.

Parameters
[in]origThe default rect to use.
[in]boundingThe bounding box to position inside of.
[in]alignThe alignment setting to use for positioning.
[in]paddingPadding to use when positioning.
[in]horizontal_ratioHorizontal ratio value relative to bounding.
[in]vertical_ratioVertical ratio value relative to bounding.
[in]xratioX ratio value relative to bounding.
[in]yratioY ratio value relative to bounding.

◆ align_algorithm_force()

EGT_API Rect align_algorithm_force ( const Rect orig,
const Rect bounding,
const AlignFlags align,
DefaultDim  padding = 0,
DefaultDim  horizontal_ratio = 0,
DefaultDim  vertical_ratio = 0,
DefaultDim  xratio = 0,
DefaultDim  yratio = 0 
)

◆ align_to_behave()

EGT_API uint32_t align_to_behave ( const AlignFlags align)

Compute lib lay behave from @align flags.

◆ alpha_collision() [1/2]

EGT_API bool alpha_collision ( const Rect lhs,
cairo_surface_t *  limage,
const Point rhs 
)

Detect alpha collision with a specific point.

This basically tests if the pixel at rhs is opaque.

lhs specified the origin with its point(). rhs is relative to this origin. lhs.size() should be the same size as the limage.

Parameters
[in]lhsThe origin and size of the limage surface.
[in]limageThe image surface.
[in]rhsThe point to test.

◆ alpha_collision() [2/2]

EGT_API bool alpha_collision ( const Rect lhs,
cairo_surface_t *  limage,
const Rect rhs,
cairo_surface_t *  rimage 
)

Detect alpha collision between two images.

This tests if any pixel from limage inside of lhs is opaque at the same time it overlaps with an opaque pixel from rimage in rhs.

Parameters
[in]lhsThe origin and size of the limage surface.
[in]limageThe first image surface.
[in]rhsThe origin and size of the rimage surface.
[in]rimageThe second image surface.

◆ angle_diff()

template<class T >
constexpr T angle_diff ( angle_start,
angle_stop,
bool  clockwise = true 
)
constexpr

Compute the angle different between two angles.

◆ bit()

template<class T >
constexpr T bit ( n)
constexpr

Utility to create a bit mask for the specified bit.

Parameters
[in]nThe bit number.

◆ cairo_format()

cairo_format_t cairo_format ( PixelFormat  format)

Convert a PixelFormat to a cairo format.

◆ change_if_diff() [1/3]

template<>
constexpr bool change_if_diff ( double &  old,
const double &  to 
)
constexpr
Parameters
oldReference to the old value.
toPotential new value.

◆ change_if_diff() [2/3]

template<>
constexpr bool change_if_diff ( float &  old,
const float &  to 
)
constexpr
Parameters
oldReference to the old value.
toPotential new value.

◆ change_if_diff() [3/3]

template<class T >
constexpr bool change_if_diff ( T &  old,
const T &  to 
)
constexpr

Utility to test and change a value if it is different.

This is a very common pattern used by Widget functions to determine whether damage() should be called when a property is changed.

Parameters
oldReference to the old value.
toPotential new value.
Returns
true if the value was changed.

◆ clamp()

template<class T >
constexpr const T & clamp ( const T &  v,
const T &  lo,
const T &  hi 
)
constexpr

Clamp a value between a hi and low value.

◆ cmp()

template<class BinaryPredicate , class InputIterator1 , class InputIterator2 >
constexpr bool cmp ( InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
BinaryPredicate  pred 
)
constexpr

◆ cwd()

EGT_API std::string cwd ( )

Get the current working directory.

◆ demangle()

EGT_API std::string demangle ( const char *  name)

Demangle a C++ symbol into something human readable.

detail::demangle(typeid(*this).name());
EGT_API std::string demangle(const char *name)
Demangle a C++ symbol into something human readable.
Note
This is g++ specific.

◆ dragged() [1/2]

EGT_API Widget * dragged ( )
protected

Get the current widget which is being dragged, or nullptr.

◆ dragged() [2/2]

EGT_API void dragged ( Widget widget)
protected

Set the current widget which is being dragged.

◆ drm_format()

uint32_t drm_format ( PixelFormat  format)

Convert a pixel format to a DRM format.

◆ egt_format() [1/2]

PixelFormat egt_format ( cairo_format_t  format)

Convert a cairo format to a pixel format.

◆ egt_format() [2/2]

PixelFormat egt_format ( uint32_t  format)

Convert a DRM format to a pixel format.

◆ enum_from_string() [1/2]

template<class T >
constexpr T enum_from_string ( const char *  value)
constexpr

Convert a string to an enum value.

◆ enum_from_string() [2/2]

template<class T >
constexpr T enum_from_string ( const std::string &  value)
constexpr

Convert a string to an enum value.

◆ enum_to_string()

template<class T >
constexpr const char * enum_to_string ( T const &  e)
constexpr

Convert an enum to a string.

◆ exe_pwd()

EGT_API std::string exe_pwd ( )

Get the directory to the current executable.

◆ exists()

EGT_API bool exists ( const std::string &  path)

Determine if a file exists.

Parameters
[in]pathFile path.

◆ extract_dirname()

EGT_API std::string extract_dirname ( const std::string &  path)

Extract the directory name from a path.

Parameters
[in]pathFile or directory path.

◆ extract_filename()

EGT_API std::string extract_filename ( const std::string &  path)

Extract the filename portion of a path or URL.

Parameters
[in]pathFile path or URL.

◆ fabs()

template<class T >
constexpr T fabs ( x,
typename std::enable_if< std::is_floating_point< T >::value >::type *  = nullptr 
)
constexpr

constexpr version of fabs/fabsf

◆ flex_layout() [1/2]

EGT_API void flex_layout ( const Rect parent,
std::vector< LayoutRect > &  children,
Justification  justify,
Orientation  orient 
)

Perform a manual flex layout given a parent rect and children rects.

◆ flex_layout() [2/2]

EGT_API void flex_layout ( const Rect parent,
std::vector< LayoutRect > &  children,
Justification  justify,
Orientation  orient,
const AlignFlags align 
)

Perform a manual flex layout with a parent and child rect, but allow a global child alignment with the align parameter.

◆ float_equal() [1/2]

constexpr bool float_equal ( const double  f1,
const double  f2 
)
constexpr

Safe equal comparison of double values.

◆ float_equal() [2/2]

constexpr bool float_equal ( const float  f1,
const float  f2 
)
constexpr

Safe equal comparison of float values.

◆ format()

template<class T >
std::string format ( value,
int  precision = 2 
)

Format a float/double to a fixed precision and return as a string.

◆ from_string()

EGT_API bool from_string ( const std::string &  x)

Convert a lexical std::string to a bool.

◆ get_mime_type() [1/2]

EGT_API std::string get_mime_type ( const std::string &  path)

Return the mime type string for a file.

This uses libmagic to identify the file if available. The default database file will be used. To override this, you can specify the path to the database file in the MAGIC environment variable.

◆ get_mime_type() [2/2]

EGT_API std::string get_mime_type ( const void *  buffer,
size_t  length 
)

Return the mime type string for a buffer.

This uses libmagic to identify the buffer if available. The default database file will be used. To override this, you can specify the path to the database file in the MAGIC environment variable.

◆ glob()

EGT_API std::vector< std::string > glob ( const std::string &  pattern)

Given a glob pattern, return a vector of matching path names.

◆ gstreamer_format()

std::string gstreamer_format ( PixelFormat  format)

Convert a pixel format to a gstreamer format.

◆ hash() [1/2]

constexpr unsigned int hash ( const char *  str,
int  h = 0 
)
constexpr

Perform a hash of a string.

◆ hash() [2/2]

unsigned int hash ( const std::string &  str)
inline

Perform a hash of a string.

◆ hextoul()

constexpr unsigned int hextoul ( const char *  str,
unsigned int  base = 16 
)
constexpr

Like, but not the same as strtoul().

The idea here is a constexpr function to convert a character string to an integer without a whole lot of error checking.

◆ ignoreparam()

template<typename T >
void ignoreparam ( T &&  )

Utility function to safely ignore a parameter to a function.

◆ image_cache()

EGT_API ImageCache & image_cache ( )

Global image cache instance.

◆ interpolate()

template<class Functor , class T >
T interpolate ( Functor &&  easing,
percent,
start,
end,
bool  reverse = false 
)

Interpolate function used internally.

Parameters
[in]easingThe easing function to use.
[in]percentThe current percent of the range.
[in]startStarting value.
[in]endEnding value.
[in]reverseShould we reverse start and end.

◆ join()

template<class T >
void join ( std::ostream &  os,
const T &  container,
const std::string &  delimiter = "," 
)

Join each item of a container with the specified delimiter between each item.

◆ justify_to_contains()

EGT_API uint32_t justify_to_contains ( Justification  justify,
Orientation  orient 
)

Compute lib lay contains from @justify and @orient parameters.

◆ keyboard_focus() [1/2]

EGT_API Widget * keyboard_focus ( )
protected

Get the current widget which has the keyboard focus, or nullptr.

◆ keyboard_focus() [2/2]

EGT_API void keyboard_focus ( Widget widget)
protected

Set the keyboard focus of a widget.

This will result in calling EventId::on_gain_focus for the new widget and EventId::on_lost_focus for any previous widget.

◆ linux_to_ekey()

EGT_API KeyboardCode linux_to_ekey ( int  code)

Map a Linux key code to an EKEY.

◆ load_image_from_filesystem()

EGT_API shared_cairo_surface_t load_image_from_filesystem ( const std::string &  path)

Load an image from the filesystem.

◆ load_image_from_memory()

EGT_API shared_cairo_surface_t load_image_from_memory ( const unsigned char *  data,
size_t  len,
const std::string &  name = {} 
)

Load an image from memory.

◆ load_image_from_network()

EGT_API shared_cairo_surface_t load_image_from_network ( const std::string &  url)

Load an image from the network.

◆ load_image_from_resource()

EGT_API shared_cairo_surface_t load_image_from_resource ( const std::string &  name)

Load an image from ResourceManager.

See also
ResourceManager

◆ ltrim()

EGT_API std::string ltrim ( const std::string &  source,
const std::string &  t = " \t\n\r" 
)

Trim delimiters off the left side of a std::string.

◆ mmod()

template<class T >
constexpr T mmod ( a,
n 
)
constexpr

Floating point safe modulus function.

◆ mouse_grab() [1/2]

EGT_API Widget * mouse_grab ( )
protected

Get the current widget which has the mouse grabbed, or nullptr.

◆ mouse_grab() [2/2]

EGT_API void mouse_grab ( Widget widget)
protected

Set the current widget to grab the mouse.

Parameters
[in]widgetThe widget to grab all mouse events, or nullptr.

◆ move()

template<typename InputIt , typename OutputIt >
constexpr OutputIt move ( InputIt  b,
InputIt  e,
OutputIt  to 
)
constexpr

◆ normalize()

template<class T >
constexpr T normalize ( value,
min,
max,
target_min,
target_max 
)
constexpr

Normalize a value, given its min and max, to a different target min and max.

Parameters
valueThe value between min and max.
minThe minimum value.
maxThe maximum value.
target_minThe minimum of the range of your desired target scaling.
target_maxThe maximum of the range of your desired target scaling.

◆ normalize_to_angle()

template<class T >
constexpr T normalize_to_angle ( value,
min,
max,
angle_start,
angle_stop,
bool  clockwise = true 
)
constexpr

Normalize a value, given its min and max, to a different target angle min and max.

Parameters
valueThe value between min and max.
minThe minimum value.
maxThe maximum value.
angle_startThe minimum of the range of your desired target angle.
angle_stopThe maximum of the range of your desired target angle.
clockwiseDirection is clockwise.

◆ on_scope_exit()

template<class T >
ScopeExit< T > on_scope_exit ( T &&  f)

Helper to construct a ScopeExit with proper type deduction of the template parameter, which may be a lambda.

◆ path_separator()

EGT_API char path_separator ( )

Get the separator character in a list of paths.

Used, for instance, in EGT_SEARCH_PATH. It should be ':' on Linux and ';' on Windows.

◆ pi()

template<typename T >
constexpr T pi ( )
constexpr

Returns the value of PI, accurate to the type used.

◆ pi_2()

template<typename T >
constexpr T pi_2 ( )
constexpr

Returns the value of PI/2, accurate to the type used.

◆ read_file()

EGT_API std::vector< unsigned char > read_file ( const std::string &  path)

Read the contents of a file into a vector.

Parameters
[in]pathFile path.

◆ readlink()

EGT_API std::string readlink ( const std::string &  path)

Read the path of a symlink.

Parameters
[in]pathSymlink path.

◆ replace_all()

EGT_API std::string replace_all ( std::string  str,
const std::string &  from,
const std::string &  to 
)

Replace all in string.

◆ resolve_path()

EGT_API SchemeType resolve_path ( const std::string &  path,
std::string &  result 
)

Resolves a path to a type and path.

This will use resolve_file_path() as appropriate.

◆ reverse_iterate()

template<typename T >
ReverseRange< T > reverse_iterate ( T &  x)

Reverse iterator to work with C++11 range based for loops in a reverse order.

for (auto& child : detail::reverse_iterate(children))
{
...
}
ReverseRange< T > reverse_iterate(T &x)
Reverse iterator to work with C++11 range based for loops in a reverse order.
Definition meta.h:139

◆ rtrim()

EGT_API std::string rtrim ( const std::string &  source,
const std::string &  t = " \t\n\r" 
)

Trim delimiters off the right side of a std::string.

◆ rule_of_5()

template<class T >
constexpr bool rule_of_5 ( )
constexpr

Rule of 5 static assert all in one.

Example usage is intended for static_assert:

static_assert(detail::rule_of_5<Color>(), "must fulfill rule of 5");

◆ size()

template<class T , std::size_t N>
constexpr std::size_t size ( const   T(&)[N])
constexprprotectednoexcept

Return the size of an array (c++17's std::size()).

◆ strip()

EGT_API void strip ( std::string &  str,
const std::string &  t = " \t\n\r" 
)

Strip the specified characters from the string.

◆ to_degrees()

template<class T >
constexpr T to_degrees ( radians)
constexpr

Convert from radians to degrees.

◆ to_radians()

template<class T >
constexpr T to_radians ( zero,
degrees 
)
constexpr

Convert from degrees to radians.

◆ to_string() [1/2]

template<>
std::string to_string ( const bool &  x)
inline

Convert a bool to a lexical std::string.

◆ to_string() [2/2]

template<class T >
std::string to_string ( const T &  x)

Convert a type to a std::string using std::ostringstream.

◆ tokenize()

EGT_API void tokenize ( const std::string &  str,
char  delimiter,
std::vector< std::string > &  tokens 
)

Tokenize a std::string.

◆ tolower()

EGT_API void tolower ( std::string &  s)

Convert a string to lowercase.

Note
Not UTF-8 aware.

◆ toupper()

EGT_API void toupper ( std::string &  s)

Convert a string to lowercase.

Note
Not UTF-8 aware.

◆ trim()

EGT_API std::string trim ( const std::string &  source,
const std::string &  t = " \t\n\r" 
)

Trim delimiters off both sides of a std::string.

◆ truncate()

EGT_API std::string truncate ( const std::string &  str,
size_t  width,
bool  ellipsis = true 
)

Truncate a string if applicable and optionally add ellipse to end.