xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject cvs commit: xml-xalan/c/Tests/Harness XMLFileReporter.hpp XMLFileReporter.cpp
Date Fri, 17 May 2002 05:52:27 GMT
dbertoni    02/05/16 22:52:27

  Modified:    c/Tests/Harness XMLFileReporter.hpp XMLFileReporter.cpp
  Log:
  More static string cleanup.
  
  Revision  Changes    Path
  1.12      +12 -2     xml-xalan/c/Tests/Harness/XMLFileReporter.hpp
  
  Index: XMLFileReporter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Harness/XMLFileReporter.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XMLFileReporter.hpp	9 May 2002 01:28:23 -0000	1.11
  +++ XMLFileReporter.hpp	17 May 2002 05:52:27 -0000	1.12
  @@ -76,7 +76,7 @@
   /**
    * Reporter that saves output to a simple XML-format file.  
    * @author Shane_Curcuru@lotus.com
  - * @version $Id: XMLFileReporter.hpp,v 1.11 2002/05/09 01:28:23 dbertoni Exp $
  + * @version $Id: XMLFileReporter.hpp,v 1.12 2002/05/17 05:52:27 dbertoni Exp $
    */
   
   #if defined(XALAN_NO_NAMESPACES)
  @@ -302,7 +302,7 @@
   	void logCheckErr(const XalanDOMString& comment);
   
   	/**
  -	* Escapes a XalanDOMString to remove < and > so it's valid XML.  
  +	* Escapes a XalanDOMString to remove <, >, ', &, and " so it's valid XML.  
   	* <P>Stolen mostly from Xalan applet sample.</P>
   	* @param s XalanDOMString to escape.
   	* @return XalanDOMString that has been escaped.
  @@ -361,7 +361,17 @@
   	static const XalanDOMString	GREATER_THAN;
   	static const XalanDOMString	EQUALS_QUOTE;
   	static const XalanDOMString	SPACE;
  +	static const XalanDOMString	QUOTE;
   	static const XalanDOMString	QUOTE_SPACE;
  +	static const XalanDOMString QUOTE_GREATER_THAN;
  +	static const XalanDOMString QUOTE_SOLIDUS_GREATER_THAN;
  +	static const XalanDOMString	PASS;
  +	static const XalanDOMString	AMBG;
  +	static const XalanDOMString	ERRR;
  +	static const XalanDOMString	FAIL;
  +	static const XalanDOMString	LESS_THAN_SOLIDUS;
  +	static const XalanDOMString	XML_HEADER;
  +	static const XalanDOMString	REASON_EQUALS_QUOTE;
   
   	/** 
   	* Optimization: for heavy use methods, form pre-defined constants to save on XalanDOMString
concatenation.  
  
  
  
  1.17      +61 -53    xml-xalan/c/Tests/Harness/XMLFileReporter.cpp
  
  Index: XMLFileReporter.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Harness/XMLFileReporter.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XMLFileReporter.cpp	9 May 2002 01:28:23 -0000	1.16
  +++ XMLFileReporter.cpp	17 May 2002 05:52:27 -0000	1.17
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -96,7 +96,17 @@
   const XalanDOMString	XMLFileReporter::GREATER_THAN(L">");
   const XalanDOMString	XMLFileReporter::EQUALS_QUOTE(L"=\"");
   const XalanDOMString	XMLFileReporter::SPACE(L" ");
  +const XalanDOMString	XMLFileReporter::QUOTE(L"\"");
   const XalanDOMString	XMLFileReporter::QUOTE_SPACE(L"\" ");
  +const XalanDOMString	XMLFileReporter::QUOTE_GREATER_THAN(L"\">");
  +const XalanDOMString	XMLFileReporter::QUOTE_SOLIDUS_GREATER_THAN(L"\"/>");
  +const XalanDOMString	XMLFileReporter::PASS(L"PASS");
  +const XalanDOMString	XMLFileReporter::AMBG(L"AMBG");
  +const XalanDOMString	XMLFileReporter::ERRR(L"ERRR");
  +const XalanDOMString	XMLFileReporter::FAIL(L"FAIL");
  +const XalanDOMString	XMLFileReporter::LESS_THAN_SOLIDUS(L"</");
  +const XalanDOMString	XMLFileReporter::XML_HEADER("<?xml version=\"1.0\"?>");
  +const XalanDOMString	XMLFileReporter::REASON_EQUALS_QUOTE("reason=\"");
   
   const XalanDOMString	XMLFileReporter::TESTCASEINIT_HDR(LESS_THAN + ELEM_TESTCASE + SPACE
+ ATTR_DESC + EQUALS_QUOTE);
   const XalanDOMString	XMLFileReporter::TESTCASECLOSE_HDR(LESS_THAN + ELEM_CASERESULT + SPACE
+ ATTR_DESC + EQUALS_QUOTE);
  @@ -105,11 +115,11 @@
   const XalanDOMString	XMLFileReporter::ARBITRARY_HDR(LESS_THAN + ELEM_ARBITRARY + SPACE
+ ATTR_LEVEL + EQUALS_QUOTE);
   const XalanDOMString	XMLFileReporter::HASHTABLE_HDR(LESS_THAN + ELEM_HASHTABLE + SPACE
+ ATTR_LEVEL + EQUALS_QUOTE);
   const XalanDOMString	XMLFileReporter::HASHITEM_HDR(LESS_THAN + ELEM_HASHITEM + SPACE +
ATTR_KEY + EQUALS_QUOTE);
  -const XalanDOMString	XMLFileReporter::CHECKPASS_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + L"PASS" + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  -const XalanDOMString	XMLFileReporter::CHECKAMBG_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + L"AMBG" + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  -const XalanDOMString	XMLFileReporter::CHECKERRR_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + L"ERRR" + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  -const XalanDOMString	XMLFileReporter::CHECKFAIL_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + L"FAIL" + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  -const XalanDOMString	XMLFileReporter::CHECKFAIL_FTR(L"</" + ELEM_CHECKRESULT + GREATER_THAN);
  +const XalanDOMString	XMLFileReporter::CHECKPASS_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + PASS + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  +const XalanDOMString	XMLFileReporter::CHECKAMBG_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + AMBG + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  +const XalanDOMString	XMLFileReporter::CHECKERRR_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + ERRR + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  +const XalanDOMString	XMLFileReporter::CHECKFAIL_HDR(LESS_THAN + ELEM_CHECKRESULT + SPACE
+ ATTR_RESULT + EQUALS_QUOTE + FAIL + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE);
  +const XalanDOMString	XMLFileReporter::CHECKFAIL_FTR(LESS_THAN_SOLIDUS + ELEM_CHECKRESULT
+ GREATER_THAN);
   
   
   XMLFileReporter::XMLFileReporter():
  @@ -268,8 +278,8 @@
   {
       if (isReady())
       {
  -        printToFile("<" + ELEM_TESTFILE 
  -                              + " " + ATTR_DESC + "=\"" + escapestring(msg) + "\" " + ATTR_TIME
+ "=\"" + getDateTimeString() + "\">");
  +        printToFile(LESS_THAN + ELEM_TESTFILE 
  +                              + SPACE + ATTR_DESC + EQUALS_QUOTE + escapestring(msg) +
QUOTE_SPACE + ATTR_TIME + EQUALS_QUOTE + getDateTimeString() + QUOTE_GREATER_THAN);
       }
   }
   
  @@ -280,9 +290,9 @@
   {
       if (isReady())
       {
  -//        printToFile("<" + ELEM_FILERESULT 
  -//                             + " " + ATTR_DESC + "=\"" + escapestring(msg) + "\" " +
ATTR_RESULT + "=\"" + result + "\" " + ATTR_TIME + "=\"" + getDateTimeString() + "\"/>");
  -        printToFile("</" + ELEM_TESTFILE + ">");
  +//        printToFile(LESS_THAN + ELEM_FILERESULT 
  +//                             + SPACE + ATTR_DESC + EQUALS_QUOTE + escapestring(msg) +
QUOTE_SPACE + ATTR_RESULT + EQUALS_QUOTE + result + QUOTE_SPACE + ATTR_TIME + EQUALS_QUOTE
+ getDateTimeString() + QUOTE_SOLIDUS_GREATER_THAN);
  +        printToFile(LESS_THAN_SOLIDUS + ELEM_TESTFILE + GREATER_THAN);
       }
       flush();
   }
  @@ -294,7 +304,7 @@
   {
       if (isReady())
       {
  -        printToFile(TESTCASEINIT_HDR + escapestring(msg) + "\">");
  +        printToFile(TESTCASEINIT_HDR + escapestring(msg) + QUOTE_GREATER_THAN);
       }
   }
   
  @@ -305,8 +315,8 @@
   {
       if (isReady())
       {
  -        //printToFile(TESTCASECLOSE_HDR + escapestring(msg) + "\" " + ATTR_RESULT + "=\""
+ result + "\"/>");
  -        printToFile("</" + ELEM_TESTCASE + ">");
  +        //printToFile(TESTCASECLOSE_HDR + escapestring(msg) + QUOTE_SPACE + ATTR_RESULT
+ EQUALS_QUOTE + result + QUOTE_SOLIDUS_GREATER_THAN);
  +        printToFile(LESS_THAN_SOLIDUS + ELEM_TESTCASE + GREATER_THAN);
       }
       if (getFlushOnCaseClose())
       {
  @@ -324,9 +334,9 @@
   
       if (isReady())
       {
  -        printToFile(MESSAGE_HDR + tmp + "\">");
  +        printToFile(MESSAGE_HDR + tmp + QUOTE_GREATER_THAN);
           printToFile(escapestring(msg));
  -        printToFile("</" + ELEM_MESSAGE +">");
  +        printToFile(LESS_THAN_SOLIDUS + ELEM_MESSAGE + GREATER_THAN);
       }
   }
   
  @@ -349,23 +359,23 @@
   //		sprintf(tmp, "%d", level);
   //
   //		Took out this level attribute cuz we don't use it.
  -//      printToFile("<" + element + " " + ATTR_LEVEL + "=\""
  -//                      + tmp + "\"");
  -        printToFile("<" + element + " ");
  +//      printToFile(LESS_THAN + element + SPACE + ATTR_LEVEL + EQUALS_QUOTE
  +//                      + tmp + QUOTE);
  +        printToFile(LESS_THAN + element + SPACE);
   	
   		Hashtable::iterator theEnd = attrs.end();	
       
          	for(Hashtable::iterator i = attrs.begin(); i != theEnd; ++i)
           {            
   			
  -            printToFile((*i).first + "=\""
  -                                  + (*i).second + "\"");
  +            printToFile((*i).first + EQUALS_QUOTE
  +                                  + (*i).second + QUOTE);
           }
   
  -        printToFile(XalanDOMString(">"));
  +        printToFile(GREATER_THAN);
           if (msg.empty() != 0)
               printToFile(escapestring(msg));
  -        printToFile("</" + element + ">");
  +        printToFile(LESS_THAN_SOLIDUS + element + GREATER_THAN);
       }
   }
   
  @@ -374,9 +384,7 @@
   {
   	if (isReady() && !element.empty() && !msg.empty())
       {
  -		printToFile("<" + element + ">");
  -		printToFile(escapestring(msg));
  -		printToFile("</" + element + ">");
  +		printToFile(LESS_THAN + element + GREATER_THAN + escapestring(msg) + LESS_THAN_SOLIDUS
+ element + GREATER_THAN);
       }
   }
   
  @@ -388,15 +396,15 @@
   		char tmp[40];
   
   		sprintf(tmp, "%d", level);
  -        printToFile(STATISTIC_HDR + tmp + "\" " + ATTR_DESC + "=\"" + escapestring(msg)
+ "\">");
  +        printToFile(STATISTIC_HDR + tmp + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE + escapestring(msg)
+ QUOTE_GREATER_THAN);
   		
   		sprintf(tmp, "%ld", lVal);
  -		printToFile("<" + ELEM_LONGVAL + ">" + tmp + "</" + ELEM_LONGVAL + ">");
  +		printToFile(LESS_THAN + ELEM_LONGVAL + GREATER_THAN + tmp + LESS_THAN_SOLIDUS + ELEM_LONGVAL
+ GREATER_THAN);
   		
   		sprintf(tmp, "%f", dVal);
  -        printToFile("<" + ELEM_DOUBLEVAL + ">" + tmp + "</" + ELEM_DOUBLEVAL +
">");
  +        printToFile(LESS_THAN + ELEM_DOUBLEVAL + GREATER_THAN + tmp + LESS_THAN_SOLIDUS
+ ELEM_DOUBLEVAL + GREATER_THAN);
           
  -		printToFile("</" + ELEM_STATISTIC + ">");
  +		printToFile(LESS_THAN_SOLIDUS + ELEM_STATISTIC + GREATER_THAN);
   		
       }
   }
  @@ -411,9 +419,9 @@
   
       if (isReady())
       {            
  -		printToFile(ARBITRARY_HDR + tmp + "\">");
  +		printToFile(ARBITRARY_HDR + tmp + QUOTE_GREATER_THAN);
           printToFile(escapestring(msg));
  -        printToFile("</" + ELEM_ARBITRARY +">");
  +        printToFile(LESS_THAN_SOLIDUS + ELEM_ARBITRARY + GREATER_THAN);
       }
   }
   
  @@ -422,11 +430,11 @@
   {
       if (isReady())
       {
  -        printToFile(HASHTABLE_HDR + level + "\" " + ATTR_DESC + "=\"" + msg + "\">");
  +        printToFile(HASHTABLE_HDR + level + QUOTE_SPACE + ATTR_DESC + EQUALS_QUOTE + msg
+ QUOTE_GREATER_THAN);
           if (hash == null)
           {
  -            printToFile("<" + ELEM_HASHITEM + " " + ATTR_KEY + "=\"null\">");
  -            printToFile("</" + ELEM_HASHITEM + ">");
  +            printToFile(LESS_THAN + ELEM_HASHITEM + SPACE + ATTR_KEY + "=\"null\">");
  +            printToFile(LESS_THAN_SOLIDUS + ELEM_HASHITEM + GREATER_THAN);
           }
           try
           {
  @@ -435,16 +443,16 @@
                   Object key = enum.nextElement();
                   // Ensure we'll have clean output by pre-fetching value before outputting
anything
                   XalanDOMString value = hash.get(key).tostring();
  -                printToFile(HASHITEM_HDR + key.tostring() + "\">");
  +                printToFile(HASHITEM_HDR + key.tostring() + QUOTE_GREATER_THAN);
                   printToFile(value);
  -                printToFile("</" + ELEM_HASHITEM + ">");
  +                printToFile(LESS_THAN_SOLIDUS + ELEM_HASHITEM + GREATER_THAN);
               }
           } 
           catch (Exception e)
           {
               // No-op: should ensure we have clean output
           }
  -        printToFile("</" + ELEM_HASHTABLE +">");
  +        printToFile(LESS_THAN_SOLIDUS + ELEM_HASHTABLE + GREATER_THAN);
       }
   }
   */
  @@ -456,7 +464,7 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKPASS_HDR + escapestring(comment) + "\"/>");
  +        printToFile(CHECKPASS_HDR + escapestring(comment) + QUOTE_SOLIDUS_GREATER_THAN);
       }
   }
   
  @@ -466,7 +474,7 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKFAIL_HDR + escapestring(comment) + "\"/>");
  +        printToFile(CHECKFAIL_HDR + escapestring(comment) + QUOTE_SOLIDUS_GREATER_THAN);
   
       }
   }
  @@ -477,9 +485,9 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKFAIL_HDR + escapestring(test) + "\"");
  +        printToFile(CHECKFAIL_HDR + escapestring(test) + QUOTE);
   
  -		printToFile(XalanDOMString(">"));
  +		printToFile(GREATER_THAN);
   		
   		Hashtable::iterator aeEnd = actexp.end();
          	for(Hashtable::iterator ii = actexp.begin(); ii != aeEnd; ++ii)
  @@ -496,16 +504,16 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKFAIL_HDR + escapestring(test) + "\"");
  +        printToFile(CHECKFAIL_HDR + escapestring(test) + QUOTE);
   
   		Hashtable::iterator fdEnd = attrs.end();	
          	for(Hashtable::iterator i = attrs.begin(); i != fdEnd; ++i)
           {            
  -            printToFile((*i).first + "=\""
  -                                  + (*i).second + "\"");
  +            printToFile((*i).first + EQUALS_QUOTE
  +                                  + (*i).second + QUOTE);
           }
   
  -		printToFile(XalanDOMString(">"));
  +		printToFile(GREATER_THAN);
   		
   		Hashtable::iterator aeEnd = actexp.end();
          	for(Hashtable::iterator ii = actexp.begin(); ii != aeEnd; ++ii)
  @@ -522,7 +530,7 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKAMBG_HDR + escapestring(comment) + "\"/>");
  +        printToFile(CHECKAMBG_HDR + escapestring(comment) + QUOTE_SOLIDUS_GREATER_THAN);
       }
   }
   
  @@ -532,7 +540,7 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKFAIL_HDR + escapestring(test) + "\" " + XalanDOMString("reason=\"")
+ escapestring(reason)  + "\"/>");
  +        printToFile(CHECKFAIL_HDR + escapestring(test) + QUOTE_SPACE + XalanDOMString(REASON_EQUALS_QUOTE)
+ escapestring(reason)  + QUOTE_SOLIDUS_GREATER_THAN);
   
       }
   }
  @@ -543,7 +551,7 @@
   {
       if (isReady())
       {
  -        printToFile(CHECKERRR_HDR + escapestring(comment) + "\"/>");
  +        printToFile(CHECKERRR_HDR + escapestring(comment) + QUOTE_SOLIDUS_GREATER_THAN);
       }
   }
   
  @@ -659,10 +667,10 @@
       if (isReady())
       {
           // Write out XML header and root test result element
  -        printToFile(XalanDOMString("<?xml version=\"1.0\"?>"));
  +        printToFile(XML_HEADER);
   
           // Note: this tag is closed in our .close() method, which the caller had better
call!
  -        printToFile("<" + ELEM_RESULTSFILE + " " + ATTR_FILENAME + "=\"" + m_fileName
+ "\">");
  +        printToFile(LESS_THAN + ELEM_RESULTSFILE + SPACE + ATTR_FILENAME + EQUALS_QUOTE
+ m_fileName + QUOTE_GREATER_THAN);
   
           return true;
       }
  @@ -683,7 +691,7 @@
   	}
   	else
       {            
  -		printToFile("</" + ELEM_RESULTSFILE + ">");
  +		printToFile(LESS_THAN_SOLIDUS + ELEM_RESULTSFILE + GREATER_THAN);
           return true;
       }
   }
  @@ -698,7 +706,7 @@
   	}
   	else
       {
  -		CharVectorType	theResult(TranscodeToLocalCodePage(output));
  +		const CharVectorType	theResult(TranscodeToLocalCodePage(output));
   
   		if(!theResult.size())
   		{
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message