Assimp v5.2.2 (January 2022)
The Asset-Importer-Lib API documentation.
StringUtils.h File Reference

Macros

#define AI_SIZEFMT   "%zu"
 
#define ai_snprintf   snprintf
 The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier. More...
 
#define INCLUDED_AI_STRINGUTILS_H
 

Functions

template<class T >
AI_FORCE_INLINE std::string ai_decimal_to_hexa (T toConvert)
 
AI_FORCE_INLINE std::string ai_rgba2hex (int r, int g, int b, int a, bool with_head)
 translate RGBA to String More...
 
AI_FORCE_INLINE std::string ai_str_toprintable (const char *in, int len, char placeholder='?')
 Make a string printable by replacing all non-printable characters with the specified placeholder character. More...
 
AI_FORCE_INLINE std::string ai_str_toprintable (const std::string &in, char placeholder='?')
 Make a string printable by replacing all non-printable characters with the specified placeholder character. More...
 
AI_FORCE_INLINE std::string ai_str_toupper (const std::string &in)
 Performs a ToLower-operation and return the upper-case string. More...
 
AI_FORCE_INLINE float ai_strtof (const char *begin, const char *end)
 
template<typename T >
AI_FORCE_INLINE std::string ai_to_string (T value)
 
template<class char_t >
AI_FORCE_INLINE char_t ai_tolower (char_t in)
 
AI_FORCE_INLINE std::string ai_tolower (const std::string &in)
 Performs a ToLower-operation and return the lower-case string. More...
 
template<class char_t >
AI_FORCE_INLINE char_t ai_toupper (char_t in)
 
AI_FORCE_INLINE std::string ai_trim (std::string &s)
 Performs a trim from both ends (in place). More...
 
AI_FORCE_INLINE void ai_trim_left (std::string &s)
 Performs a trim from start (in place) More...
 
AI_FORCE_INLINE void ai_trim_right (std::string &s)
 Performs a trim from end (in place). More...
 

Macro Definition Documentation

◆ AI_SIZEFMT

#define AI_SIZEFMT   "%zu"

◆ ai_snprintf

ai_snprintf   snprintf

The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier.

Parameters
outBufThe buffer to write in
sizeThe buffer size
formatThe format string
apThe additional arguments.
Returns
The number of written characters if the buffer size was big enough. If an encoding error occurs, a negative number is returned.

◆ INCLUDED_AI_STRINGUTILS_H

#define INCLUDED_AI_STRINGUTILS_H

Function Documentation

◆ ai_decimal_to_hexa()

template<class T >
AI_FORCE_INLINE std::string ai_decimal_to_hexa ( toConvert)

◆ ai_rgba2hex()

AI_FORCE_INLINE std::string ai_rgba2hex ( int  r,
int  g,
int  b,
int  a,
bool  with_head 
)

translate RGBA to String

Parameters
raiColor.r
gaiColor.g
baiColor.b
aaiColor.a
with_head#
Returns
The hexadecimal string, is empty in case of an error.

◆ ai_str_toprintable() [1/2]

AI_FORCE_INLINE std::string ai_str_toprintable ( const char *  in,
int  len,
char  placeholder = '?' 
)

Make a string printable by replacing all non-printable characters with the specified placeholder character.

Parameters
inThe incoming string.
lenThe length of the incoming string.
placeholderPlaceholder character, default is a question mark.
Returns
The string, with all non-printable characters replaced. Will return an empty string if in is null or len is <= 0.

◆ ai_str_toprintable() [2/2]

AI_FORCE_INLINE std::string ai_str_toprintable ( const std::string &  in,
char  placeholder = '?' 
)

Make a string printable by replacing all non-printable characters with the specified placeholder character.

Parameters
inThe incoming string.
placeholderPlaceholder character, default is a question mark.
Returns
The string, with all non-printable characters replaced.

◆ ai_str_toupper()

AI_FORCE_INLINE std::string ai_str_toupper ( const std::string &  in)

Performs a ToLower-operation and return the upper-case string.

Parameters
inThe incoming string.
Returns
The string as uppercase.

◆ ai_strtof()

AI_FORCE_INLINE float ai_strtof ( const char *  begin,
const char *  end 
)

◆ ai_to_string()

template<typename T >
AI_FORCE_INLINE std::string ai_to_string ( value)

◆ ai_tolower() [1/2]

template<class char_t >
AI_FORCE_INLINE char_t ai_tolower ( char_t  in)

◆ ai_tolower() [2/2]

AI_FORCE_INLINE std::string ai_tolower ( const std::string &  in)

Performs a ToLower-operation and return the lower-case string.

Parameters
inThe incoming string.
Returns
The string as lowercase.

◆ ai_toupper()

template<class char_t >
AI_FORCE_INLINE char_t ai_toupper ( char_t  in)

◆ ai_trim()

AI_FORCE_INLINE std::string ai_trim ( std::string &  s)

Performs a trim from both ends (in place).

Parameters
sstring to trim.

◆ ai_trim_left()

AI_FORCE_INLINE void ai_trim_left ( std::string &  s)

Performs a trim from start (in place)

Parameters
sstring to trim.

◆ ai_trim_right()

AI_FORCE_INLINE void ai_trim_right ( std::string &  s)

Performs a trim from end (in place).

Parameters
sstring to trim.