39 char _tmpFileName[] =
"fileXXXXXX";
40 int fd = mkstemp(_tmpFileName);
42 #else // mainly Windows 43 char _tmpFileName[] =
"fileXXXXXX";
44 _mktemp_s(_tmpFileName, strlen(_tmpFileName));
47 return std::string(_tmpFileName);
50 bool endsWith(std::string
const& value, std::string
const& ending) {
51 if (ending.size() > value.size())
return false;
52 return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
55 std::vector< std::string >
split(
const std::string& str,
56 const std::string& delim) {
57 std::vector< std::string > tokens;
58 size_t prev = 0, pos = 0;
60 pos = str.find(delim, prev);
61 if (pos == std::string::npos) pos = str.length();
62 std::string token = str.substr(prev, pos - prev);
63 if (!token.empty()) tokens.push_back(token);
64 prev = pos + delim.length();
65 }
while (pos < str.length() && prev < str.length());
81 const std::string& val,
82 const std::string& new_val) {
84 auto pos = retVal.find(val);
85 while (pos != std::string::npos) {
86 std::stringstream sBuff;
87 sBuff << s.substr(0, pos) << new_val
88 << s.substr(pos + val.size(), std::string::npos);
90 pos = retVal.find(val);
99 #endif // GUM_NO_INLINE std::string getUniqueFileName()
Returns a path to a unique file name.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< std::string > split(const std::string &str, const std::string &delim)
Split str using the delimiter.
bool endsWith(std::string const &value, std::string const &ending)
Returns true if value ends with ending.
std::string replace(const std::string &s, const std::string &val, const std::string &new_val)
not usable for gcc 4.8 std::vector<std::string> split( const std::string& orig, const std::string& de...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.