added \ escaping in XRC (patch 1042675)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2004-10-12 10:23:16 +00:00
parent 0f0e71f433
commit 984c33c9c7
3 changed files with 36 additions and 14 deletions

View File

@ -35,11 +35,11 @@ NODE, PROPERTY and VALUE in the XML sense:
The term ATTRIBUTE is specific to XRC and refers to a subnode
of an <object> or <object_ref> node that is itself not <object> or <object_ref>.
In the example bellow, <pos>, <label> and <style> are attributes, while neither
In the example below, <pos>, <label> and <style> are attributes, while neither
<resource> nor either of <object>s is:
<?xml version="1.0" encoding="utf-8">
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.3.0.1">
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
<object class="wxPanel">
<style>wxSUNKEN_BORDER</style> <!-- attr -->
<object class="wxStaticText">
@ -78,7 +78,7 @@ entitled "Version Note".
The <resource> node contains namespace declaration, too:
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.3.0.1">
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
The <resource> node is only allowed to have <object> and <object_ref>
subnodes, all of which must have the "name" property.
@ -155,6 +155,8 @@ by XRC parser according to this table:
"\n" -> line break (C character '\n')
"\r" -> carriage return (C character '\r')
"\t" -> tabelator (C character '\t')
"\\" -> "\"
(introduced in version 2.5.3.0, not done in earlier versions)
Version Note:
'$' was used instead of '_' prior to version 2.3.0.1.
@ -214,7 +216,7 @@ Any of "stock_id" or "stock_client" properties or the filename may be omitted.
XRC determines the bitmap to use according to this algorithm:
1. If there is non-empty "stock_id" property, query wxArtProvider for the
bitmap (if there is no "stock_client", use default one, which is usually
wxART_OTHER; exceptions are noted in class-specific sections bellow). If
wxART_OTHER; exceptions are noted in class-specific sections below). If
the query fails, continue to 2.
2. Load the bitmap from the file in attribute value.
@ -279,7 +281,7 @@ wxCheckList
position Position -1,-1
size Size -1,-1
style Style[wxCheckList]
content (see bellow) (empty)
content (see below) (empty)
Optional "content" attribute does not have attribute value. Instead,
arbitrary number of <item> nodes may be rooted under it (the control

View File

@ -58,10 +58,10 @@ class wxXmlResourceModule;
// - reset revision to 0 unless the first three are same as before,
// in which case you should increase revision by one
#define WX_XMLRES_CURRENT_VERSION_MAJOR 2
#define WX_XMLRES_CURRENT_VERSION_MINOR 3
#define WX_XMLRES_CURRENT_VERSION_RELEASE 0
#define WX_XMLRES_CURRENT_VERSION_REVISION 1
#define WX_XMLRES_CURRENT_VERSION_STRING _T("2.3.0.1")
#define WX_XMLRES_CURRENT_VERSION_MINOR 5
#define WX_XMLRES_CURRENT_VERSION_RELEASE 3
#define WX_XMLRES_CURRENT_VERSION_REVISION 0
#define WX_XMLRES_CURRENT_VERSION_STRING _T("2.5.3.0")
#define WX_XMLRES_CURRENT_VERSION \
(WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \

View File

@ -788,14 +788,34 @@ wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate)
else
str2 << wxT('&') << *dt;
}
// Remap \n to CR, \r to LF, \t to TAB:
// Remap \n to CR, \r to LF, \t to TAB, \\ to \:
else if (*dt == wxT('\\'))
switch (*(++dt))
{
case wxT('n') : str2 << wxT('\n'); break;
case wxT('t') : str2 << wxT('\t'); break;
case wxT('r') : str2 << wxT('\r'); break;
default : str2 << wxT('\\') << *dt; break;
case wxT('n'):
str2 << wxT('\n');
break;
case wxT('t'):
str2 << wxT('\t');
break;
case wxT('r'):
str2 << wxT('\r');
break;
case wxT('\\') :
// "\\" wasn't translated to "\" prior to 2.5.3.0:
if (m_resource->CompareVersion(2,5,3,0) >= 0)
{
str2 << wxT('\\');
break;
}
// else fall-through to default: branch below
default:
str2 << wxT('\\') << *dt;
break;
}
else str2 << *dt;
}