wxPlatform.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00027 #ifndef HUGIN_WXPLATFORM_H
00028 #define HUGIN_WXPLATFORM_H
00029 
00030 #include "hugin_shared.h"
00031 #include <wx/string.h>
00032 
00033 namespace hugin_utils {
00034 
00035 template <class str>
00036 str wxQuoteStringInternal(const str & arg, const str & quotechar,
00037                         const str & replacements)
00038 {
00039     // loop over all chars..
00040     str ret(arg);
00041     size_t len = replacements.size();
00042     for (size_t i = 0; i < len; i++) {
00043         str source(replacements.substr(i,1));
00044         str dest(quotechar + source);
00045         size_t idx = 0;
00046         do {
00047             idx = ret.find(source,idx);
00048             if (idx != str::npos) {
00049                 ret.replace(idx, 1, dest);
00050                 // skip to next unknown char.
00051                 idx += 2;
00052             }
00053         } while (idx != str::npos);
00054     }
00055     return ret;
00056 }
00057 
00065 template <class str>
00066 str wxQuoteString(const str & arg)
00067 {
00068 #ifdef _WIN32
00069     // escape all strange chars with ^
00070     // is this true for create process?
00071     return wxQuoteStringInternal(arg, str(wxT("^")), str(wxT("^ \"$|()")));
00072 #else
00073     return wxQuoteStringInternal(arg, str(wxT("\\")), str(wxT("\\ ~$\"|'`{}[]()")));
00074 #endif
00075 }
00076 
00081 template <class str>
00082 str wxQuoteFilename(const str & arg)
00083 {
00084 #ifdef _WIN32
00085     str ret;
00086     // just a guess
00087     ret = wxQuoteStringInternal(arg, str(wxT("^")), str(wxT("\"")));
00088     return str(wxT("\"")) + ret + str(wxT("\""));
00089 #else
00090     str ret;
00091     ret = wxQuoteStringInternal(arg, str(wxT("\\")), str(wxT("\"")));
00092     return str(wxT("\"")) + ret + str(wxT("\""));
00093 #endif
00094     }
00095 
00096 WXIMPEX wxString doubleTowxString(double d, int digits=-1);
00097 WXIMPEX bool str2double(const wxString& s, double & d);
00098 
00099 } // namespace
00100 
00101 #if defined __WXMSW__ && !wxCHECK_VERSION(3,1,1)
00102   // workaround for wxWidgets bug 14888
00103   // see: http://trac.wxwidgets.org/ticket/14888
00104   // which results in crashes when calling help on Win 8/10 64 bit
00105   // implement a slightly different version for our needs
00106 #include "wx/msw/helpchm.h"
00107 class WXIMPEX HuginCHMHelpController :public wxCHMHelpController
00108 {
00109 public:
00110     void DisplayHelpPage(const wxString& name);
00111 };
00112 #endif
00113 
00114 #endif // HUGIN_WXPLATFORM_H

Generated on 27 Aug 2016 for Hugintrunk by  doxygen 1.4.7