SSS - S3 Toolkit 0.9.6
S3 client library and applications
Loading...
Searching...
No Matches
utility.h File Reference

internal utility functions More...

#include <algorithm>
#include <functional>
#include <string>
#include <unordered_map>
+ Include dependency graph for utility.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

class  sss::SplitIterator
 Iterator over splits. More...
 
class  sss::SplitRange
 Range over splits. More...
 

Functions

template<class ContainerT >
void sss::Split (const std::string &str, ContainerT &cont, const std::string &delims=" ", const size_t count=std::string::npos)
 
auto sss::begin (const SplitRange &sr)
 return iterator at start position
 
auto sss::end (const SplitRange &sr)
 return iterator at end position
 
int sss::RandomIndex (int lowerBound, int upperBound)
 
size_t sss::FileSize (const std::string &filename)
 
Toml sss::ParseTomlFile (const std::string &filename)
 
std::string sss::GetHomeDir ()
 
void sss::TrimLine (std::string &s)
 
std::string sss::ToUpper (std::string s)
 
std::string sss::ToLower (std::string s)
 

Detailed Description

internal utility functions

Function Documentation

◆ FileSize()

size_t sss::FileSize ( const std::string &  filename)

Return file size

Parameters
filenamefile name
Returns
file size in number of bytes

References sss::FileSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHomeDir()

std::string sss::GetHomeDir ( )

Return home directory

Returns
home directory path

References sss::GetHomeDir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParseTomlFile()

Toml sss::ParseTomlFile ( const std::string &  filename)

Parse Toml file in AWS format and return tree as map of maps

Works with AWS format (nested s'=') Parent key is added added to child key: <parent key>/<child_key>'

Parameters
filenamelocation of configuration file
Returns
Toml content

References sss::GetHomeDir(), and sss::ParseTomlFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RandomIndex()

int sss::RandomIndex ( int  lowerBound,
int  upperBound 
)

Return integer in [low,high] range

Parameters
lowerBoundlower bound
upperBoundupper bound
Returns
random value in interval [lowerBound, upperBound]

References sss::RandomIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Split()

template<class ContainerT >
void sss::Split ( const std::string &  str,
ContainerT &  cont,
const std::string &  delims = " ",
const size_t  count = std::string::npos 
)

Split string and put substrings into container

Parameters
[in]strinput text
[out]contcontainer with push_back() method
[in]delimsdelimiter
[in]countnumber of delimiters to parse

References sss::Split().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToLower()

std::string sss::ToLower ( std::string  s)

Convert to lowercase

Parameters
stext
Returns
lowercase text

References sss::ToLower().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToUpper()

std::string sss::ToUpper ( std::string  s)

Convert to uppercase text

Parameters
stext
Returns
uppercase text

References sss::ToUpper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TrimLine()

void sss::TrimLine ( std::string &  s)

Remove leading '#' and leading and trailing blanks in place

References sss::TrimLine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: