Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
iv::utils Namespace Reference

Namespaces

namespace  license
 
namespace  map
 
namespace  vector
 

Classes

class  Calendar
 

Functions

template<typename T , iv::concepts::StringRepresentable Str>
std::optional< T > parseNumber (const Str &stringNumber)
 
uint8_t maxBitsLength (const iv::eDataType dataType)
 
bool isValidDateTime (const iv::DateTime &dateTime)
 
bool isNeedUpdateClock (const iv::types::timestamp timeUtc, const int16_t offsetGmt)
 
std::string stringJoin (const std::vector< std::string > &strings, char delim)
 
uint32_t stringToIpv4 (std::string_view str)
 
std::string ipv4ToString (uint32_t ip)
 
std::string toLowerString (std::string_view in)
 
bool hostWildcardMatch (std::string_view issued_, std::string_view host_)
 
std::optional< size_t > findCharacterInString (std::string_view str, char car)
 
uint8_t calculateDecimalDigits (std::string_view str)
 
uint8_t calculateDecimalDigits (double precision)
 
std::string demangle (const std::type_info &ti)
 
std::string iso88591_to_utf8 (const std::string_view input)
 
bool isHexadecimalString (const std::string &str)
 
template<typename CharT1 , typename CharT2 >
requires std::convertible_to<CharT1, char> && std::convertible_to<CharT2, char>
int32_t compareSubstring (const CharT1 *str1, const CharT2 *str2, std::size_t length)
 Simple comparator of x chars where x is the length provided.
 
template<typename StringType >
requires std::convertible_to<StringType, const char *>
void appendToString (std::string *strResult, StringType str)
 Concatenate two string.
 
template<typename StringType , typename DelimiterType >
requires std::is_convertible_v<StringType, std::string> || (std::is_convertible_v<StringType, std::string_view> && (std::is_convertible_v<DelimiterType, std::string> || std::is_same_v<DelimiterType, typename StringType::value_type>) )
std::vector< StringType > splitOn (const StringType &str, const DelimiterType &delim)
 
template<typename StringType >
requires std::is_convertible_v<StringType, std::string> or std::is_convertible_v<StringType, std::string_view>
std::string truncate (const StringType &str, size_t length, bool show_ellipsis=true)
 
template<iv::concepts::StringRepresentable T1, iv::concepts::StringRepresentable T2>
bool isEqualStringsCaseInsensitive (const T1 &str1, const T2 &str2)
 
template<iv::concepts::StringRepresentable T1, iv::concepts::StringRepresentable T2>
bool isEqual (const T1 &str1, const T2 &str2)
 
void replaceSubString (std::string &source, const std::string &strToSearch, const std::string &strToReplace)
 Look for a substring into a string and when it is found, replace it for another substring.
 
void replaceChar (std::string *str, char charSearching, char charToChange)
 Look for a character into a string and when it is found, replace it for another character.
 
std::string createWithInitialization (char car, uint64_t numChars)
 
bool isAlphaNumericCharacter (char car)
 
bool isAlphabeticCharacter (char car)
 
bool isSpecialRealNumberCharacter (char car)
 
bool isSpecialIntegerCharacter (char car)
 
bool isDigitCharacter (char car)
 
bool isValidRealNumberCharacter (char car)
 
bool isValidIntegerCharacter (char car)
 
bool isHexadecimalCharacter (char car)
 
template<typename T >
requires iv::concepts::IntegerType<T> || iv::concepts::FloatingPointType<T>
std::string formatNumber (T number, std::optional< uint8_t > precision=std::nullopt)
 Check if a string is a number, only applies precision to floating point numbers.
 

Function Documentation

◆ appendToString()

template<typename StringType >
requires std::convertible_to<StringType, const char *>
void iv::utils::appendToString ( std::string * strResult,
StringType str )
inline

Concatenate two string.

Parameters
strResultString result of the concatenation
strString to concatenate

◆ calculateDecimalDigits() [1/2]

uint8_t iv::utils::calculateDecimalDigits ( double precision)

◆ calculateDecimalDigits() [2/2]

uint8_t iv::utils::calculateDecimalDigits ( std::string_view str)

◆ compareSubstring()

template<typename CharT1 , typename CharT2 >
requires std::convertible_to<CharT1, char> && std::convertible_to<CharT2, char>
int32_t iv::utils::compareSubstring ( const CharT1 * str1,
const CharT2 * str2,
std::size_t length )
inline

Simple comparator of x chars where x is the length provided.

Parameters
str1The first string to compare
str2The second string to compare
lengthThe amount of chars to compare
Returns
int32_t 0 if the strings have the same characters in the given length, in other case, it will return a negative or positive value depending on if the str1 has a lower different character respect of the str2's one or not respectively

◆ createWithInitialization()

std::string iv::utils::createWithInitialization ( char car,
uint64_t numChars )
inline

◆ demangle()

std::string iv::utils::demangle ( const std::type_info & ti)

◆ findCharacterInString()

std::optional< size_t > iv::utils::findCharacterInString ( std::string_view str,
char car )

◆ formatNumber()

template<typename T >
requires iv::concepts::IntegerType<T> || iv::concepts::FloatingPointType<T>
std::string iv::utils::formatNumber ( T number,
std::optional< uint8_t > precision = std::nullopt )

Check if a string is a number, only applies precision to floating point numbers.

Template Parameters
T
Parameters
number
precision
Returns

◆ hostWildcardMatch()

bool iv::utils::hostWildcardMatch ( std::string_view issued_,
std::string_view host_ )

Check if the given hostname is a match for the specified wildcard

◆ ipv4ToString()

std::string iv::utils::ipv4ToString ( uint32_t ipAddr)

Convert an IPv4 address to a string

Parameters
ip_addrthe IPv4 address to convert
Returns
string representation of the IPv4 address

◆ isAlphabeticCharacter()

bool iv::utils::isAlphabeticCharacter ( char car)
inline

◆ isAlphaNumericCharacter()

bool iv::utils::isAlphaNumericCharacter ( char car)
inline

◆ isDigitCharacter()

bool iv::utils::isDigitCharacter ( char car)
inline

◆ isEqual()

bool iv::utils::isEqual ( const T1 & str1,
const T2 & str2 )

◆ isEqualStringsCaseInsensitive()

bool iv::utils::isEqualStringsCaseInsensitive ( const T1 & str1,
const T2 & str2 )

◆ isHexadecimalCharacter()

bool iv::utils::isHexadecimalCharacter ( char car)
inline

◆ isHexadecimalString()

bool iv::utils::isHexadecimalString ( const std::string & str)

◆ isNeedUpdateClock()

bool iv::utils::isNeedUpdateClock ( const iv::types::timestamp timeUtc,
const int16_t offsetGmt )
inline

◆ iso88591_to_utf8()

std::string iv::utils::iso88591_to_utf8 ( const std::string_view input)

◆ isSpecialIntegerCharacter()

bool iv::utils::isSpecialIntegerCharacter ( char car)
inline

◆ isSpecialRealNumberCharacter()

bool iv::utils::isSpecialRealNumberCharacter ( char car)
inline

◆ isValidDateTime()

bool iv::utils::isValidDateTime ( const iv::DateTime & dateTime)
inline

◆ isValidIntegerCharacter()

bool iv::utils::isValidIntegerCharacter ( char car)
inline

◆ isValidRealNumberCharacter()

bool iv::utils::isValidRealNumberCharacter ( char car)
inline

◆ maxBitsLength()

uint8_t iv::utils::maxBitsLength ( const iv::eDataType dataType)

◆ parseNumber()

template<typename T , iv::concepts::StringRepresentable Str>
std::optional< T > iv::utils::parseNumber ( const Str & stringNumber)

◆ replaceChar()

void iv::utils::replaceChar ( std::string * str,
char charSearching,
char charToChange )
inline

Look for a character into a string and when it is found, replace it for another character.

Parameters
strString to iterate
charSearchingCharacter to search
charToChangeCharacter to replace for

◆ replaceSubString()

void iv::utils::replaceSubString ( std::string & source,
const std::string & strToSearch,
const std::string & strToReplace )
inline

Look for a substring into a string and when it is found, replace it for another substring.

Parameters
sourceString to iterate
strToSearchSubstring to replace
strToReplaceSubstring to replace for

◆ splitOn()

template<typename StringType , typename DelimiterType >
requires std::is_convertible_v<StringType, std::string> || (std::is_convertible_v<StringType, std::string_view> && (std::is_convertible_v<DelimiterType, std::string> || std::is_same_v<DelimiterType, typename StringType::value_type>) )
std::vector< StringType > iv::utils::splitOn ( const StringType & str,
const DelimiterType & delim )

Split a string

Parameters
strthe input string
delimthe delimiter
Returns
string split by delim

◆ stringJoin()

std::string iv::utils::stringJoin ( const std::vector< std::string > & strings,
char delim )

Join a string

Parameters
stringsstrings to join
delimthe delimiter
Returns
string joined by delim

◆ stringToIpv4()

uint32_t iv::utils::stringToIpv4 ( std::string_view ipStr)

Convert a string representation of an IPv4 address to a number

Parameters
ipStrthe string representation
Returns
integer IPv4 address

◆ toLowerString()

std::string iv::utils::toLowerString ( std::string_view in)

◆ truncate()

template<typename StringType >
requires std::is_convertible_v<StringType, std::string> or std::is_convertible_v<StringType, std::string_view>
std::string iv::utils::truncate ( const StringType & str,
size_t length,
bool show_ellipsis = true )