Pioneer
Loading...
Searching...
No Matches
Classes | Macros | Functions
utils.h File Reference
#include "core/Log.h"
#include "libs.h"
#include <fmt/printf.h>
#include <stdarg.h>
#include <stdio.h>
#include <string>
#include <vector>
Include dependency graph for utils.h:

Go to the source code of this file.

Classes

struct  reverse_container_t< T >
 

Macros

#define __attribute(x)
 
#define RETURN_ZERO_NONGNU_ONLY   return 0;
 
#define ALIGN(x, a)   __ALIGN_MASK(x, (a - 1))
 
#define __ALIGN_MASK(x, mask)   (((x) + (mask)) & ~(mask))
 

Functions

template<typename... Args>
void Output (const char *message, Args... args)
 
template<typename... Args>
void Warning (const char *message, Args... args)
 
template<typename... Args>
void Error (const char *message, Args... args)
 
template<typename... Args>
void DebugMsg (const char *message, Args... args)
 
std::string string_join (std::vector< std::string > &v, std::string sep)
 
std::string format_date (double time)
 
std::string format_date_only (double time)
 
std::string format_distance (double dist, int precision=2)
 
std::string format_money (double cents, bool showCents=true)
 
std::string format_duration (double seconds)
 
const char * pi_strcasestr (const char *haystack, const char *needle)
 
bool starts_with (const std::string_view s, const std::string_view t)
 
bool ends_with (const std::string_view s, const std::string_view t)
 
bool starts_with_ci (const std::string_view s, const std::string_view t)
 
bool ends_with_ci (const std::string_view s, const std::string_view t)
 
bool compare_ci (const std::string_view s, const std::string_view t)
 
std::string_view read_line (std::string_view &s)
 
std::string_view strip_spaces (std::string_view &s)
 
std::vector< std::string > SplitString (const std::string &source, const std::string &delim)
 
std::string FloatToStr (float val)
 
std::string DoubleToStr (double val)
 
std::string AutoToStr (Sint32 val)
 
std::string AutoToStr (Sint64 val)
 
std::string AutoToStr (float val)
 
std::string AutoToStr (double val)
 
void Vector3fToStr (const vector3f &val, char *out, size_t size)
 
void Vector3dToStr (const vector3d &val, char *out, size_t size)
 
void Matrix3x3fToStr (const matrix3x3f &val, char *out, size_t size)
 
void Matrix3x3dToStr (const matrix3x3d &val, char *out, size_t size)
 
void Matrix4x4fToStr (const matrix4x4f &val, char *out, size_t size)
 
void Matrix4x4dToStr (const matrix4x4d &val, char *out, size_t size)
 
Sint64 StrToSInt64 (const std::string &str)
 
Uint64 StrToUInt64 (const std::string &str)
 
float StrToFloat (const std::string &str)
 
double StrToDouble (const std::string &str)
 
void StrToAuto (Sint32 *pVal, const std::string &str)
 
void StrToAuto (Sint64 *pVal, const std::string &str)
 
void StrToAuto (float *pVal, const std::string &str)
 
void StrToAuto (double *pVal, const std::string &str)
 
void StrToVector3f (const char *str, vector3f &val)
 
void StrToVector3d (const char *str, vector3d &val)
 
void StrToMatrix3x3f (const char *str, matrix3x3f &val)
 
void StrToMatrix3x3d (const char *str, matrix3x3d &val)
 
void StrToMatrix4x4f (const char *str, matrix4x4f &val)
 
void StrToMatrix4x4d (const char *str, matrix4x4d &val)
 
std::string DecimalToDegMinSec (float dec)
 
template<typename T >
reverse_container_t< T > reverse_container (T &ref)
 
void hexdump (const unsigned char *buf, int bufsz)
 

Macro Definition Documentation

◆ __ALIGN_MASK

#define __ALIGN_MASK (   x,
  mask 
)    (((x) + (mask)) & ~(mask))

◆ __attribute

#define __attribute (   x)

◆ ALIGN

#define ALIGN (   x,
 
)    __ALIGN_MASK(x, (a - 1))

◆ RETURN_ZERO_NONGNU_ONLY

#define RETURN_ZERO_NONGNU_ONLY   return 0;

Function Documentation

◆ AutoToStr() [1/4]

std::string AutoToStr ( double  val)
Here is the call graph for this function:

◆ AutoToStr() [2/4]

std::string AutoToStr ( float  val)
Here is the call graph for this function:

◆ AutoToStr() [3/4]

std::string AutoToStr ( Sint32  val)

◆ AutoToStr() [4/4]

std::string AutoToStr ( Sint64  val)

◆ compare_ci()

bool compare_ci ( const std::string_view  s,
const std::string_view  t 
)
inline

◆ DebugMsg()

template<typename... Args>
void DebugMsg ( const char *  message,
Args...  args 
)
inline
Here is the call graph for this function:

◆ DecimalToDegMinSec()

std::string DecimalToDegMinSec ( float  dec)

Converts geographic coordinates from decimal to degree/minutes/seconds format and returns a string.

Here is the call graph for this function:

◆ DoubleToStr()

std::string DoubleToStr ( double  val)

◆ ends_with()

bool ends_with ( const std::string_view  s,
const std::string_view  t 
)
inline

◆ ends_with_ci()

bool ends_with_ci ( const std::string_view  s,
const std::string_view  t 
)
inline

◆ Error()

template<typename... Args>
void Error ( const char *  message,
Args...  args 
)
inline
Here is the call graph for this function:

◆ FloatToStr()

std::string FloatToStr ( float  val)

◆ format_date()

std::string format_date ( double  time)
Here is the call graph for this function:

◆ format_date_only()

std::string format_date_only ( double  time)
Here is the call graph for this function:

◆ format_distance()

std::string format_distance ( double  dist,
int  precision = 2 
)

◆ format_duration()

std::string format_duration ( double  seconds)

◆ format_money()

std::string format_money ( double  cents,
bool  showCents = true 
)

◆ hexdump()

void hexdump ( const unsigned char *  buf,
int  bufsz 
)
Here is the call graph for this function:

◆ Matrix3x3dToStr()

void Matrix3x3dToStr ( const matrix3x3d val,
char *  out,
size_t  size 
)

◆ Matrix3x3fToStr()

void Matrix3x3fToStr ( const matrix3x3f val,
char *  out,
size_t  size 
)

◆ Matrix4x4dToStr()

void Matrix4x4dToStr ( const matrix4x4d val,
char *  out,
size_t  size 
)

◆ Matrix4x4fToStr()

void Matrix4x4fToStr ( const matrix4x4f val,
char *  out,
size_t  size 
)

◆ Output()

template<typename... Args>
void Output ( const char *  message,
Args...  args 
)
inline
Here is the call graph for this function:

◆ pi_strcasestr()

const char * pi_strcasestr ( const char *  haystack,
const char *  needle 
)

◆ read_line()

std::string_view read_line ( std::string_view &  s)
inline

◆ reverse_container()

template<typename T >
reverse_container_t< T > reverse_container ( T &  ref)

◆ SplitString()

std::vector< std::string > SplitString ( const std::string &  source,
const std::string &  delim 
)

◆ starts_with()

bool starts_with ( const std::string_view  s,
const std::string_view  t 
)
inline

◆ starts_with_ci()

bool starts_with_ci ( const std::string_view  s,
const std::string_view  t 
)
inline

◆ string_join()

std::string string_join ( std::vector< std::string > &  v,
std::string  sep 
)

◆ strip_spaces()

std::string_view strip_spaces ( std::string_view &  s)
inline

◆ StrToAuto() [1/4]

void StrToAuto ( double *  pVal,
const std::string &  str 
)
Here is the call graph for this function:

◆ StrToAuto() [2/4]

void StrToAuto ( float *  pVal,
const std::string &  str 
)
Here is the call graph for this function:

◆ StrToAuto() [3/4]

void StrToAuto ( Sint32 *  pVal,
const std::string &  str 
)

◆ StrToAuto() [4/4]

void StrToAuto ( Sint64 *  pVal,
const std::string &  str 
)

◆ StrToDouble()

double StrToDouble ( const std::string &  str)

◆ StrToFloat()

float StrToFloat ( const std::string &  str)

◆ StrToMatrix3x3d()

void StrToMatrix3x3d ( const char *  str,
matrix3x3d val 
)

◆ StrToMatrix3x3f()

void StrToMatrix3x3f ( const char *  str,
matrix3x3f val 
)

◆ StrToMatrix4x4d()

void StrToMatrix4x4d ( const char *  str,
matrix4x4d val 
)

◆ StrToMatrix4x4f()

void StrToMatrix4x4f ( const char *  str,
matrix4x4f val 
)

◆ StrToSInt64()

Sint64 StrToSInt64 ( const std::string &  str)

◆ StrToUInt64()

Uint64 StrToUInt64 ( const std::string &  str)

◆ StrToVector3d()

void StrToVector3d ( const char *  str,
vector3d val 
)

◆ StrToVector3f()

void StrToVector3f ( const char *  str,
vector3f val 
)

◆ Vector3dToStr()

void Vector3dToStr ( const vector3d val,
char *  out,
size_t  size 
)

◆ Vector3fToStr()

void Vector3fToStr ( const vector3f val,
char *  out,
size_t  size 
)

◆ Warning()

template<typename... Args>
void Warning ( const char *  message,
Args...  args 
)
inline
Here is the call graph for this function: