// misc accessors
wxString GetAppName() const { return m_appName; }
wxString GetVendorName() const { return m_vendorName; }
+ // Used wxIniConfig to set members in constructor
+ void SetAppName(const wxString& appName) { m_appName = appName; }
+ void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
void SetStyle(long style) { m_style = style; }
long GetStyle() const { return m_style; }
const wxString& localFilename,
const wxString& globalFilename,
long style)
- : wxConfigBase(!strAppName && wxTheApp ? wxTheApp->GetAppName()
+ : wxConfigBase(strAppName, strVendor, localFilename, globalFilename, style)
+
+#if 0 // This is too complex for some compilers, e.g. BC++ 5.01
+ : wxConfigBase((strAppName.IsEmpty() && wxTheApp) ? wxTheApp->GetAppName()
: strAppName,
- !strVendor ? (wxTheApp ? wxTheApp->GetVendorName()
+ strVendor.IsEmpty() ? (wxTheApp ? wxTheApp->GetVendorName()
: strAppName)
: strVendor,
localFilename, globalFilename, style)
+#endif
{
+ if (strAppName.IsEmpty() && wxTheApp)
+ SetAppName(wxTheApp->GetAppName());
+ if (strVendor.IsEmpty() && wxTheApp)
+ SetVendorName(wxTheApp->GetVendorName());
+
m_strLocalFilename = localFilename;
if (m_strLocalFilename.IsEmpty())
{
}
stream << " style = '" << styleBuf << "',\\\n";
- stream << " title = '" << item->GetTitle() << "',\\\n";
+ stream << " title = " << SafeWord(item->GetTitle()) << ",\\\n";
stream << " id = " << item->GetId() << ",\\\n";
stream << " x = " << item->GetX() << ", y = " << item->GetY();
stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight();
}
}
-// Returns quoted string or ''
+// Returns quoted string or '' : convert " to \"
char *SafeWord(const wxString& s)
{
- if (s == "")
- return "''";
- else
- {
- strcpy(wxBuffer, "'");
- strcat(wxBuffer, (const char*) s);
- strcat(wxBuffer, "'");
- return wxBuffer;
- }
+ const char *cp;
+ char *dp;
+
+ if (s == "")
+ return "''";
+ else
+ {
+ dp = wxBuffer;
+ cp = s.c_str();
+ *dp++ = '\'';
+ while(*cp != 0) {
+ if(*cp == '"') {
+ *dp++ = '\\';
+ *dp++ = '"';
+ } else if(*cp == '\'') {
+ *dp++ = '\\';
+ *dp++ = '\'';
+ } else
+ *dp++ = *cp;
+
+ cp++;
+ }
+ *dp++ = '\'';
+ *dp++ = 0;
+
+ return wxBuffer;
+ }
}