SUNphi  1.0
String.hpp File Reference

Header file to support string operations. More...

#include <cstring>
#include <string>

Go to the source code of this file.

Classes

struct  SUNphi::IncapsulatedString< Chars >
 

Macros

#define PROVIDE_NAME(STR)
 Provides a static name() method to a class, returning STR. More...
 

Functions

const char * SUNphi::cString (const char *in)
 
const char * SUNphi::cString (const std::string &in)
 
std::string SUNphi::substrBetweenPos (const std::string &str, const size_t &beg, const size_t &end)
 Returns a substring out of the passed chars, among position beg and end. More...
 
constexpr size_t SUNphi::__strLength (char)
 Length of a char.
 
size_t SUNphi::__strLength (const std::string &str)
 Length of a std::string.
 
size_t SUNphi::__strLength (const char *str)
 Length of a c-string.
 
template<typename T >
std::string SUNphi::substrBetween (const std::string &str, const T &i, const T &f)
 Returns a substring out of the passed delimiters. More...
 

Detailed Description

Header file to support string operations.

Definition in file String.hpp.

Macro Definition Documentation

#define PROVIDE_NAME (   STR)
Value:
\
static constexpr const char* name() \
{ \
return \
STR; \
}

Provides a static name() method to a class, returning STR.

Definition at line 24 of file String.hpp.

Function Documentation

const char* SUNphi::cString ( const char *  in)
inline

Returns the c-string of the passed quantity

Case in which the input is already a c-string

Parameters
inInput

Definition at line 35 of file String.hpp.

const char* SUNphi::cString ( const std::string &  in)
inline

Returns the c-string of the passed quantity

Case in which the input is a c++ string

Parameters
inInput

Definition at line 44 of file String.hpp.

template<typename T >
std::string SUNphi::substrBetween ( const std::string &  str,
const T &  i,
const T &  f 
)
inline

Returns a substring out of the passed delimiters.

Position of beginning token

Beginning of the substring

End of the substring

Parameters
strSubstring to split
iBeginning token
fEnd token

Definition at line 88 of file String.hpp.

std::string SUNphi::substrBetweenPos ( const std::string &  str,
const size_t &  beg,
const size_t &  end 
)
inline

Returns a substring out of the passed chars, among position beg and end.

Length to return

Parameters
strSubstring to split
begBeginning position
endEnd position

Definition at line 51 of file String.hpp.