Hugin trunk 0.1
Loading...
Searching...
No Matches
wxPlatform.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
27#ifndef HUGIN_WXPLATFORM_H
28#define HUGIN_WXPLATFORM_H
29
30#include "hugin_shared.h"
31#include <wx/string.h>
32
33namespace hugin_utils {
34
35template <class str>
37 const str & replacements)
38{
39 // loop over all chars..
40 str ret(arg);
41 size_t len = replacements.size();
42 for (size_t i = 0; i < len; i++) {
43 str source(replacements.substr(i,1));
45 size_t idx = 0;
46 do {
47 idx = ret.find(source,idx);
48 if (idx != str::npos) {
49 ret.replace(idx, 1, dest);
50 // skip to next unknown char.
51 idx += 2;
52 }
53 } while (idx != str::npos);
54 }
55 return ret;
56}
57
65template <class str>
67{
68#ifdef _WIN32
69 // escape all strange chars with ^
70 // is this true for create process?
71 return wxQuoteStringInternal(arg, str("^"), str("^ \"$|()"));
72#else
73 return wxQuoteStringInternal(arg, str("\\"), str("\\ ~$\"|'`{}[]()"));
74#endif
75}
76
81template <class str>
83{
84#ifdef _WIN32
85 str ret;
86 // just a guess
87 ret = wxQuoteStringInternal(arg, str("^"), str("\""));
88 return str("\"") + ret + str("\"");
89#else
90 str ret;
91 ret = wxQuoteStringInternal(arg, str("\\"), str("\""));
92 return str("\"") + ret + str("\"");
93#endif
94 }
95
97WXIMPEX bool str2double(const wxString& s, double & d);
98
99} // namespace
100
101#ifndef __WXMSW__
104#endif
105
106#if defined __WXGTK__
109#endif
110
111#endif // HUGIN_WXPLATFORM_H
#define WXIMPEX
namespace for various utils
bool str2double(const wxString &s, double &d)
wxString doubleTowxString(double d, int digits)
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
Definition wxPlatform.h:82
str wxQuoteStringInternal(const str &arg, const str &quotechar, const str &replacements)
Definition wxPlatform.h:36
str wxQuoteString(const str &arg)
Try to escape special chars on windows and linux.
Definition wxPlatform.h:66
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41
WXIMPEX void FixHelpSettings()
helper function to check window position settings of help window