Crombie Tools
crombie::Misc Namespace Reference

Functions

template<typename O , typename C , typename F >
std::vector< O > comprehension (const C &container, const F &func)
 
void draw_progress (unsigned progress, unsigned max)
 
std::string env (const std::string &variable, const std::string &fallback="")
 Get an environment variable by name, with an optional fallback value. More...
 
std::string shell (const std::string &cmd)
 Get the output of a shell command. More...
 
Types::strings split (const std::string &str, const std::string &delim="\)
 Splits a string. More...
 
Types::strings tokenize (const std::string &str)
 Split the contents of a string into multiple strings. More...
 

Function Documentation

§ comprehension()

template<typename O , typename C , typename F >
std::vector<O> crombie::Misc::comprehension ( const C &  container,
const F &  func 
)

Definition at line 105 of file Misc.h.

§ draw_progress()

void crombie::Misc::draw_progress ( unsigned  progress,
unsigned  max 
)

Definition at line 22 of file Misc.h.

References Debug::Debug().

Referenced by crombie::FileConfig::FileConfig::runfiles().

§ env()

§ shell()

std::string crombie::Misc::shell ( const std::string &  cmd)

Get the output of a shell command.

Definition at line 77 of file Misc.h.

Referenced by crombie::FileSystem::dirname().

§ split()

Types::strings crombie::Misc::split ( const std::string &  str,
const std::string &  delim = "\n" 
)

§ tokenize()

Types::strings crombie::Misc::tokenize ( const std::string &  str)

Split the contents of a string into multiple strings.

This is different than crombie::Misc::split because it can split over multiple spaces, while spilt_string only splits over one character at a time.

Definition at line 49 of file Misc.h.

Referenced by crombie::FileSystem::dirname(), crombie::Selection::operator>>(), crombie::Uncertainty::operator>>(), and crombie::FileConfig::operator>>().