27 #ifndef _HUGIN_UTILS_PLATFORM_H
28 #define _HUGIN_UTILS_PLATFORM_H
36 #if ((defined __APPLE__) && (defined __MACH__))
43 #if __unix__ || MAC_OS_X
50 namespace hugin_utils {
55 const str & replacements)
59 size_t len = replacements.size();
60 for (
size_t i = 0; i < len; i++) {
61 str source(replacements.substr(i,1));
62 str dest(quotechar + source);
63 size_t destlen = dest.size();
66 idx = ret.find(source,idx);
67 if (idx != str::npos) {
68 ret.replace(idx, 1, dest);
72 }
while (idx != str::npos);
80 str replaceBackslash(
const str & arg)
86 idx = ret.find(str(
"\\"),idx);
89 ret.replace(idx, 1, str(
"/"));
93 while (idx != str::npos);
164 return str(
"\"") + ret + str(
"\"");
168 return str(
"\"") + ret + str(
"\"");
175 #endif // _HUGIN_UTILS_PLATFORM_H
str quoteStringInternal(const str &arg, const str "echar, const str &replacements)
utility function; escapes characters in replacements with quotechar.
str quoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
str quoteString(const str &arg)
Try to escape special chars on windows and linux.
str escapeStringMake(const str &arg)
Escape dangerous chars in makefile strings/filenames (space),#,=.
str quoteStringShell(const str &arg)
Try to escape special chars in a string used by a unix type shell.