Skip to content

builtin/functions.cpp

Functions

Name
std::string toString(float const & val, int const precision)
std::string toString(double const & val, int const precision)
std::string toString(int const & val, int const precision)
std::vector< unsigned char > readFile(std::string const & path)
expected< std::string > readFileAsString(std::string const & path)
bool saveToFile(std::string const & path, std::string const & data)
bool iequals(std::string const & a, std::string const & b)
std::string get_time_string(std::string const & time_format)
bool str_replace(std::string & str, std::string const & from, std::string const & to)
std::vector< std::string > split_str(std::string const & s, char delimiter)
bool is_number(std::string const & s)
bool in_string(std::string const & full, std::string const & subString)
bool in_vector(std::vector< std::string > const & vec, std::string const & s)
bool in_vector(std::vector< int > const & vec, int const & i)
bool file_exists(std::string const & file_path)
std::mt19937 gen(rd() )
std::uniform_int_distribution dis(0 , 15 )
std::uniform_int_distribution dis2(8 , 11 )
std::string generate_uuid_v4()
std::string to_string_with_precision(float const value, int const n)
std::string time_in_HH_MM_SS_MMM()
expected< std::string > timePointToISOString(std::time_t const & timePoint)
expected< std::time_t > isoStringToTime(std::string const & timeInIsoFormat)
expected< std::string > getCurrentTimeInISOFormat(int daysToAdd)
expected< std::time_t > getCurrentTimeInUtc()
std::chrono::milliseconds getCurrentTimeInUtcMs()
std::string urlEncode(std::string const & url)
std::string urlDecode(std::string const & url)
void safeStrcpy(char * dest, char const * src, size_t const destSize)
std::string getEnvVar(std::string const & varName)
bool setEnvVar(std::string const & name, std::string const & value)
bool isValidFilename(std::string const & filename)
std::string toUtf8(std::wstring const & wstr)
std::wstring fromUtf8(std::string const & str)
bool isValidIPAddress(const std::string & ipAddress)
bool isValidPort(const std::string & port)
bool isValidNonNegativeInteger(const std::string & fileSize)

Attributes

Name
std::random_device rd

Functions Documentation

function toString

std::string toString(
    float const & val,
    int const precision
)

function toString

std::string toString(
    double const & val,
    int const precision
)

function toString

std::string toString(
    int const & val,
    int const precision
)

function readFile

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

function readFileAsString

expected< std::string > readFileAsString(
    std::string const & path
)

function saveToFile

bool saveToFile(
    std::string const & path,
    std::string const & data
)

function iequals

bool iequals(
    std::string const & a,
    std::string const & b
)

function get_time_string

std::string get_time_string(
    std::string const & time_format
)

function str_replace

bool str_replace(
    std::string & str,
    std::string const & from,
    std::string const & to
)

function split_str

std::vector< std::string > split_str(
    std::string const & s,
    char delimiter
)

function is_number

bool is_number(
    std::string const & s
)

function in_string

bool in_string(
    std::string const & full,
    std::string const & subString
)

function in_vector

bool in_vector(
    std::vector< std::string > const & vec,
    std::string const & s
)

function in_vector

bool in_vector(
    std::vector< int > const & vec,
    int const & i
)

function file_exists

bool file_exists(
    std::string const & file_path
)

function gen

static std::mt19937 gen(
    rd() 
)

function dis

static std::uniform_int_distribution dis(
    0 ,
    15 
)

function dis2

static std::uniform_int_distribution dis2(
    8 ,
    11 
)

function generate_uuid_v4

std::string generate_uuid_v4()

function to_string_with_precision

std::string to_string_with_precision(
    float const value,
    int const n
)

function time_in_HH_MM_SS_MMM

std::string time_in_HH_MM_SS_MMM()

function timePointToISOString

expected< std::string > timePointToISOString(
    std::time_t const & timePoint
)

function isoStringToTime

expected< std::time_t > isoStringToTime(
    std::string const & timeInIsoFormat
)

function getCurrentTimeInISOFormat

expected< std::string > getCurrentTimeInISOFormat(
    int daysToAdd
)

function getCurrentTimeInUtc

expected< std::time_t > getCurrentTimeInUtc()

function getCurrentTimeInUtcMs

std::chrono::milliseconds getCurrentTimeInUtcMs()

function urlEncode

std::string urlEncode(
    std::string const & url
)

function urlDecode

std::string urlDecode(
    std::string const & url
)

function safeStrcpy

void safeStrcpy(
    char * dest,
    char const * src,
    size_t const destSize
)

function getEnvVar

std::string getEnvVar(
    std::string const & varName
)

function setEnvVar

bool setEnvVar(
    std::string const & name,
    std::string const & value
)

function isValidFilename

bool isValidFilename(
    std::string const & filename
)

function toUtf8

std::string toUtf8(
    std::wstring const & wstr
)

function fromUtf8

std::wstring fromUtf8(
    std::string const & str
)

function isValidIPAddress

bool isValidIPAddress(
    const std::string & ipAddress
)

function isValidPort

bool isValidPort(
    const std::string & port
)

function isValidNonNegativeInteger

bool isValidNonNegativeInteger(
    const std::string & fileSize
)

Attributes Documentation

variable rd

static std::random_device rd;

Updated on 2024-12-23 at 14:18:24 +0000