Update of /cvsroot/audacity/audacity-src/src/xml
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv8420

Modified Files:
        XMLTagHandler.cpp XMLTagHandler.h XMLWriter.cpp XMLWriter.h 
Log Message:
Moved XMLEsc from XMLTagHandler to XMLWriter since it's only used when
writing XML files and XMLTagHandler is used while reading.


Index: XMLTagHandler.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLTagHandler.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- XMLTagHandler.h     25 Jun 2007 23:12:35 -0000      1.11
+++ XMLTagHandler.h     20 May 2009 05:55:51 -0000      1.12
@@ -72,20 +72,6 @@
    // handle this child, return NULL and it will be ignored.
    virtual XMLTagHandler *HandleXMLChild(const wxChar *tag) = 0;
 
-   // When this method is called, write your own tag and tags for
-   // all of your children to the file.  One tag should appear
-   // per line, and each tag should be preceded with [depth]
-   // tab characters.
-   virtual void WriteXML(XMLWriter &xmlFile) = 0;
-
-   //
-   // Utility methods you should call
-   //
-
-   // Escape a string, replacing certain characters with their
-   // XML encoding, i.e. '<' becomes '&lt;'
-   static wxString XMLEsc(wxString s);
-
    // These functions recieve data from expat.  They do charset
    // conversion and then pass the data to the handlers above.
    bool ReadXMLTag(const char *tag, const char **attrs);

Index: XMLWriter.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLWriter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- XMLWriter.h 1 May 2009 18:26:33 -0000       1.4
+++ XMLWriter.h 20 May 2009 05:55:51 -0000      1.5
@@ -56,6 +56,10 @@
 
    virtual void Write(const wxString &data) = 0;
 
+   // Escape a string, replacing certain characters with their
+   // XML encoding, i.e. '<' becomes '&lt;'
+   wxString XMLEsc(const wxString & s);
+
  protected:
 
    bool mInTag;

Index: XMLWriter.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLWriter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- XMLWriter.cpp       1 May 2009 18:26:33 -0000       1.4
+++ XMLWriter.cpp       20 May 2009 05:55:51 -0000      1.5
@@ -103,7 +103,7 @@
 {
    Write(wxString::Format(wxT(" %s=\"%s\""),
       name.c_str(),
-      XMLTagHandler::XMLEsc(value).c_str()));
+      XMLEsc(value).c_str()));
 }
 
 void XMLWriter::WriteAttr(const wxChar *name, const wxChar *value)
@@ -213,7 +213,7 @@
       Write(wxT("\t"));
    }
 
-   Write(XMLTagHandler::XMLEsc(value));
+   Write(XMLEsc(value));
 }
 
 void XMLWriter::WriteData(const wxChar *value)
@@ -242,6 +242,50 @@
    Write(wxString(value));
 }
 
+// See http://www.w3.org/TR/REC-xml for reference
+wxString XMLWriter::XMLEsc(const wxString & s)
+{
+   wxString result;
+   int len = s.Length();
+
+   for(int i=0; i<len; i++) {
+      wxChar c = s.GetChar(i);
+
+      switch (c) {
+         case wxT('\''):
+            result += wxT("&apos;");
+         break;
+
+         case wxT('"'):
+            result += wxT("&quot;");
+         break;
+
+         case wxT('&'):
+            result += wxT("&amp;");
+         break;
+
+         case wxT('<'):
+            result += wxT("&lt;");
+         break;
+
+         case wxT('>'):
+            result += wxT("&gt;");
+         break;
+
+         default:
+            if (!wxIsprint(c)) {
+               result += wxString::Format(wxT("&#x%04x;"), c);
+            }
+            else {
+               result += c;
+            }
+         break;
+      }
+   }
+
+   return result;
+}
+
 ///
 /// XMLFileWriter class
 ///

Index: XMLTagHandler.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/xml/XMLTagHandler.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- XMLTagHandler.cpp   14 Mar 2009 18:32:08 -0000      1.12
+++ XMLTagHandler.cpp   20 May 2009 05:55:51 -0000      1.13
@@ -150,51 +150,6 @@
    return (nValue == int16Sample) || (nValue == int24Sample) || (nValue == 
floatSample);
 }
 
-
-// See http://www.w3.org/TR/REC-xml for reference
-wxString XMLTagHandler::XMLEsc(wxString s)
-{
-   wxString result;
-   int len = s.Length();
-
-   for(int i=0; i<len; i++) {
-      wxChar c = s.GetChar(i);
-
-      switch (c) {
-         case wxT('\''):
-            result += wxT("&apos;");
-         break;
-
-         case wxT('"'):
-            result += wxT("&quot;");
-         break;
-
-         case wxT('&'):
-            result += wxT("&amp;");
-         break;
-
-         case wxT('<'):
-            result += wxT("&lt;");
-         break;
-
-         case wxT('>'):
-            result += wxT("&gt;");
-         break;
-
-         default:
-            if (!wxIsprint(c)) {
-               result += wxString::Format(wxT("&#x%04x;"), c);
-            }
-            else {
-               result += c;
-            }
-         break;
-      }
-   }
-
-   return result;
-}
-
 bool XMLTagHandler::ReadXMLTag(const char *tag, const char **attrs)
 {
    wxArrayString tmp_attrs;


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to