noos::misc Namespace Reference

common misc helper functions More...

Functions

std::string decode64 (const std::string &val)
 decode base64 More...
 
std::string encode64 (const std::string &val)
 encode base64 More...
 
std::string random_boundary ()
 Create a random boundary for the multipart/form in HTTP.
 
std::string escape_string (const std::string &str)
 escape JSON strings when sending them over the socket More...
 
template<class F , class... Args>
void for_each_arg (F &&f, Args &&...args)
 expand variadic arguments using a fold expression More...
 
template<typename T >
get_json_value (const std::string key, const nlohmann::json &json_f)
 method to check if the string exists in the actual json
 
bool check_json (nlohmann::json &json, const std::string json_str)
 method to check if JSON data is correct
 
bool check_error (const nlohmann::json json, const std::string error_str="error")
 function to check if an error has been received from
 
bool save_dec_image (std::string data, std::string filename)
 take decoded data and save it into an image More...
 

Detailed Description

common misc helper functions

Version
0.7.3
Author
Alex Giokas a.gki.nosp@m.okas.nosp@m.@orte.nosp@m.lio..nosp@m.co.uk
Date
10 June 2017

Function Documentation

std::string noos::misc::decode64 ( const std::string &  val)
inline

decode base64

Parameters
valmust be encoded using base64

Here is the caller graph for this function:

std::string noos::misc::encode64 ( const std::string &  val)
inline

encode base64

Parameters
valmust be plain-text string
Returns
a base64 encoded string
std::string noos::misc::escape_string ( const std::string &  str)
inline

escape JSON strings when sending them over the socket

Parameters
strwill be escaped and returned
template<class F , class... Args>
void noos::misc::for_each_arg ( F &&  f,
Args &&...  args 
)

expand variadic arguments using a fold expression

Parameters
fof template parameter F is the function (a lambda) receiving the expanded object
argsis the variadic list of args
bool noos::misc::save_dec_image ( std::string  data,
std::string  filename 
)
inline

take decoded data and save it into an image

Parameters
std::stringdata is the image data before decoding
filenameis path where to save the image

Here is the call graph for this function: