Made iniconf compile on BC++ 5.01 (involved adding Set... accessors to wxConfigBase);
added SafeWord patch to Dialog Editor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -226,6 +226,9 @@ public:
|
|||||||
// misc accessors
|
// misc accessors
|
||||||
wxString GetAppName() const { return m_appName; }
|
wxString GetAppName() const { return m_appName; }
|
||||||
wxString GetVendorName() const { return m_vendorName; }
|
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; }
|
void SetStyle(long style) { m_style = style; }
|
||||||
long GetStyle() const { return m_style; }
|
long GetStyle() const { return m_style; }
|
||||||
|
@@ -60,13 +60,22 @@ wxIniConfig::wxIniConfig(const wxString& strAppName,
|
|||||||
const wxString& localFilename,
|
const wxString& localFilename,
|
||||||
const wxString& globalFilename,
|
const wxString& globalFilename,
|
||||||
long style)
|
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,
|
: strAppName,
|
||||||
!strVendor ? (wxTheApp ? wxTheApp->GetVendorName()
|
strVendor.IsEmpty() ? (wxTheApp ? wxTheApp->GetVendorName()
|
||||||
: strAppName)
|
: strAppName)
|
||||||
: strVendor,
|
: strVendor,
|
||||||
localFilename, globalFilename, style)
|
localFilename, globalFilename, style)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
if (strAppName.IsEmpty() && wxTheApp)
|
||||||
|
SetAppName(wxTheApp->GetAppName());
|
||||||
|
if (strVendor.IsEmpty() && wxTheApp)
|
||||||
|
SetVendorName(wxTheApp->GetVendorName());
|
||||||
|
|
||||||
m_strLocalFilename = localFilename;
|
m_strLocalFilename = localFilename;
|
||||||
if (m_strLocalFilename.IsEmpty())
|
if (m_strLocalFilename.IsEmpty())
|
||||||
{
|
{
|
||||||
|
@@ -108,7 +108,7 @@ bool wxResourceTableWithSaving::SaveResource(wxTextOutputStream& stream, wxItemR
|
|||||||
}
|
}
|
||||||
|
|
||||||
stream << " style = '" << styleBuf << "',\\\n";
|
stream << " style = '" << styleBuf << "',\\\n";
|
||||||
stream << " title = '" << item->GetTitle() << "',\\\n";
|
stream << " title = " << SafeWord(item->GetTitle()) << ",\\\n";
|
||||||
stream << " id = " << item->GetId() << ",\\\n";
|
stream << " id = " << item->GetId() << ",\\\n";
|
||||||
stream << " x = " << item->GetX() << ", y = " << item->GetY();
|
stream << " x = " << item->GetX() << ", y = " << item->GetY();
|
||||||
stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight();
|
stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight();
|
||||||
@@ -576,17 +576,35 @@ char *SafeString(const wxString& s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns quoted string or ''
|
// Returns quoted string or '' : convert " to \"
|
||||||
char *SafeWord(const wxString& s)
|
char *SafeWord(const wxString& s)
|
||||||
{
|
{
|
||||||
if (s == "")
|
const char *cp;
|
||||||
return "''";
|
char *dp;
|
||||||
else
|
|
||||||
{
|
if (s == "")
|
||||||
strcpy(wxBuffer, "'");
|
return "''";
|
||||||
strcat(wxBuffer, (const char*) s);
|
else
|
||||||
strcat(wxBuffer, "'");
|
{
|
||||||
return wxBuffer;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user