]> git.saurik.com Git - wxWidgets.git/commitdiff
added \ escaping in XRC (patch 1042675)
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 12 Oct 2004 10:23:16 +0000 (10:23 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 12 Oct 2004 10:23:16 +0000 (10:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/tech/tn0014.txt
include/wx/xrc/xmlres.h
src/xrc/xmlres.cpp

index faf109044ca593976619bf9788b9fd5ad2e56e81..29e4f027e1573aa8d33285afdf00d36f3dcb7dc2 100644 (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>. 
 
 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> 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">
         <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:
 
 
 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.
 
 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')
     "\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.
 
 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
 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.
 
      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]
 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
 
 Optional "content" attribute does not have attribute value. Instead,
 arbitrary number of <item> nodes may be rooted under it (the control
index a2194f1198a625cb6a28a64443f596aa3316b023..5d40588f547911a12f4778af5783b0731eb671ba 100644 (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
 //       - 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 + \
 
 #define WX_XMLRES_CURRENT_VERSION \
                 (WX_XMLRES_CURRENT_VERSION_MAJOR * 256*256*256 + \
index 197ea98480f8dd9c55fe235a3467313e12f2ffa0..bc99da66a1dc1358e8f9eb3c8004711ae65caf21 100644 (file)
@@ -788,14 +788,34 @@ wxString wxXmlResourceHandler::GetText(const wxString& param, bool translate)
             else
                 str2 << wxT('&') << *dt;
         }
             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))
             {
         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;
     }
             }
         else str2 << *dt;
     }