X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d699f48ba33c96c24f7ab3764ad98ded0633c1c5..e6275f8d02f48a96918b4601b99a644ac0b4d4da:/contrib/src/applet/prepinclude.cpp?ds=sidebyside diff --git a/contrib/src/applet/prepinclude.cpp b/contrib/src/applet/prepinclude.cpp index 600bd30579..bf03a84ef8 100644 --- a/contrib/src/applet/prepinclude.cpp +++ b/contrib/src/applet/prepinclude.cpp @@ -27,18 +27,52 @@ * ****************************************************************************/ -// For compilers that support precompilation -#include "wx/wxprec.h" -//#include "wx/file.h" -#include "wx/filesys.h" // Include private headers #include "wx/applet/prepinclude.h" +#include "wx/applet/echovar.h" + +// wxWindows +#include "wx/filesys.h" +#include "wx/msgdlg.h" + +/*----------------------------- Implementation ----------------------------*/ #define RECURSE_LIMIT 50 -/*---------------------------- Global variables ---------------------------*/ +/**************************************************************************** +PARAMETERS: +text - text to process for echo variables -/*----------------------------- Implementation ----------------------------*/ +RETURNS: +The string containing the processed filename + +REMARKS: +This routine searches through the text of the filename for variables contained +in % percent signs +****************************************************************************/ +wxString ParseFilename( + wxString &text) +{ + int f = 0; + int e; + while ((f = text.find('%', f)) != wxString::npos) { + f++; + e = text.find('%', f); +#ifdef CHECKED + if (e == wxString::npos) { + wxMessageBox(wxString("wxHTML #include error: % signs should bracket variable names in file attribute. To use a percent sign in a filename write double percents (%%)."), "Error" ,wxICON_ERROR); + return text; + } +#endif + if (e == f) + text.replace(f-1, 2, "%"); + else { + wxString varname = text.Mid(f, (e-f)); + text.replace(f-1, (e-f)+2, wxEchoVariable::GetValue(varname)); + } + } + return text; +} /**************************************************************************** PARAMETERS: @@ -58,10 +92,6 @@ wxString wxIncludePrep::Process( { int i; char ft[] = "