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/src/xalanc/Utils/MsgCreator ICUResHandler.cpp ICUResHandler.hpp InMemHandler.cpp InMemHandler.hpp MsgCreator.cpp MsgCreator.hpp MsgFileOutputStream.cpp NLSHandler.cpp NLSHandler.hpp SAX2Handler.cpp SAX2Handler.hpp
Date Wed, 31 Dec 2003 21:49:57 GMT
dbertoni    2003/12/31 13:49:57

  Modified:    c/src/xalanc/Utils/MsgCreator ICUResHandler.cpp
                        ICUResHandler.hpp InMemHandler.cpp InMemHandler.hpp
                        MsgCreator.cpp MsgCreator.hpp
                        MsgFileOutputStream.cpp NLSHandler.cpp
                        NLSHandler.hpp SAX2Handler.cpp SAX2Handler.hpp
  Log:
  Patch for Bugzilla 25847.
  
  Revision  Changes    Path
  1.4       +17 -13    xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.cpp
  
  Index: ICUResHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ICUResHandler.cpp	3 Dec 2003 21:47:56 -0000	1.3
  +++ ICUResHandler.cpp	31 Dec 2003 21:49:56 -0000	1.4
  @@ -59,12 +59,16 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  +#include "ICUResData.hpp"
   #include "ICUResHandler.hpp"
  +
  +#include <xercesc/sax2/Attributes.hpp>
  +#include <xercesc/util/XMLUniDefs.hpp>
  +
   #include <cstdio>
   #include <cassert>
  -#include <xercesc/util/XMLUniDefs.hpp>
  -#include <xercesc/sax2/Attributes.hpp>
  -#include "ICUResData.hpp"
  +
  +
   
   
   // -----------------------------------------------------------------------
  @@ -93,7 +97,7 @@
   
   
   // ICU genrb doesnt' like " and {} chars
  -// change tham with \", \{ and /}
  +// change tham with \", \{ and \}
   
   void ICUResHandler::characters(	const   XMLCh* const    chars
   						, const unsigned int    length)
  @@ -107,7 +111,7 @@
   
   		int j = 0;
   
  -		for ( int i=0 ; i < length ; i++ , j++)
  +		for ( unsigned int i=0 ; i < length ; i++ , j++)
   		{
   			if( chars[i] == chDoubleQuote || chars[i] == chOpenCurly || chars[i] == chCloseCurly)
   			{
  @@ -138,15 +142,15 @@
   
   }
   
  -void ICUResHandler::endElement(const XMLCh* const uri,
  +void ICUResHandler::endElement(const XMLCh* const ,
   					const XMLCh* const localname,
  -					const XMLCh* const qname)
  +					const XMLCh* const )
   {
   	if ( m_startCollectingCharacters == false)
   		return;
   
   
  -    if(!XMLString::compareString(localname,targetXMLCh))
  +    if(!XMLString::compareString(localname,s_targetXMLCh))
   	{
   		m_startCollectingCharacters = false;
   
  @@ -160,15 +164,15 @@
   								const   Attributes&		attributes)
   {
   	
  -	if(!XMLString::compareString(localname,trans_unitXMLCh))
  +	if(!XMLString::compareString(localname,s_transUnitXMLCh))
   	{
   		// this is an elemente, SAX2Handler class is responsible to handle:
   		// creating Index file, commom for all localization styles
   		SAX2Handler::startElement(uri, localname, qname, attributes);
   	}
  -	else if(!XMLString::compareString(localname,targetXMLCh))
  +	else if(!XMLString::compareString(localname,s_targetXMLCh))
   	{
  -		if ( m_XML_lang != 0 )
  +		if ( m_locale != 0 )
   		{
   			m_startCollectingCharacters = true;	
   			
  @@ -183,9 +187,9 @@
   {
   	printToDataFile( szApacheLicense );
   
  -	if ( m_XML_lang != 0)
  +	if ( m_locale != 0)
   	{
  -		m_fStream.write(m_XML_lang,XMLString::stringLen(m_XML_lang));
  +		m_fStream.write(m_locale,XMLString::stringLen(m_locale));
   
   	}
   
  
  
  
  1.3       +39 -19    xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.hpp
  
  Index: ICUResHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/ICUResHandler.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ICUResHandler.hpp	2 Dec 2003 22:38:00 -0000	1.2
  +++ ICUResHandler.hpp	31 Dec 2003 21:49:56 -0000	1.3
  @@ -58,9 +58,7 @@
   #if !defined(ICURESHANDLER_MSGCREATOR_1357924680)
   #define ICURESHANDLER_MSGCREATOR_1357924680
   
  -#include "InMemHandler.hpp"
  -
  -#include "MsgFileOutputStream.hpp"
  +#include "SAX2Handler.hpp"
   
   
   XERCES_CPP_NAMESPACE_USE
  @@ -73,36 +71,58 @@
       // -----------------------------------------------------------------------
       ICUResHandler(const char* fileName);
   
  +    virtual 
       ~ICUResHandler();
   	// -----------------------------------------------------------------------
       //  Implementations of the SAX DocumentHandler interface
       // -----------------------------------------------------------------------
  -	void endDocument();
  -	void endElement(const XMLCh* const uri,
  +	virtual void 
  +	endDocument();
  +	virtual void 
  +	endElement(const XMLCh* const ,
   								 const XMLCh* const localname,
  -								 const XMLCh* const qname)	;
  -	void startDocument();
  -
  -	void startElement(const   XMLCh* const    uri,
  -									const   XMLCh* const    localname,
  -									const   XMLCh* const    qname,
  -                                    const   Attributes&		attributes);
  +								 const XMLCh* const )	;
  +	virtual void 
  +	startDocument();
  +
  +	virtual void 
  +	startElement(const   XMLCh* const    uri,
  +								const   XMLCh* const    localname,
  +								const   XMLCh* const    qname,
  +                                const   Attributes&		attributes);
   
  -	void characters(	const   XMLCh* const    chars
  +	virtual void 
  +	characters(	const   XMLCh* const    chars
   						, const unsigned int    length);
   
   protected:
  -	virtual void createHeaderForDataFile ();
  -	virtual void createBottomForDataFile ();
  -
  -	virtual void printBeginOfDataLine ();
  -	virtual void printEndOfDataLine ();
  +	virtual void 
  +	createHeaderForDataFile ();
  +	
  +	virtual void 
  +	createBottomForDataFile ();
  +
  +	virtual void 
  +	printBeginOfDataLine ();
  +	
  +	virtual void 
  +	printEndOfDataLine ();
   
  -	void printToDataFile( const char* sArrayOfStrins[] );
  +	void 
  +	printToDataFile( const char* sArrayOfStrins[] );
   
   
   	XalanFileOutputStream	m_fStream;
   
  +private:
  +	// Not implemented...
  +	ICUResHandler&
  +	operator=(const ICUResHandler&);
  +
  +	ICUResHandler(const ICUResHandler&);
  +
  +	bool
  +	operator==(const ICUResHandler&) const;
   };
   
   #endif // ICURESHANDLER_MSGCREATOR_1357924680
  
  
  
  1.5       +5 -5      xml-xalan/c/src/xalanc/Utils/MsgCreator/InMemHandler.cpp
  
  Index: InMemHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/InMemHandler.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- InMemHandler.cpp	29 Dec 2003 00:26:54 -0000	1.4
  +++ InMemHandler.cpp	31 Dec 2003 21:49:56 -0000	1.5
  @@ -141,15 +141,15 @@
   
   }
   
  -void InMemHandler::endElement(const XMLCh* const uri,
  +void InMemHandler::endElement(const XMLCh* const ,
   					const XMLCh* const localname,
  -					const XMLCh* const qname)
  +					const XMLCh* const )
   {
   	if ( m_startCollectingCharacters == false)
   		return;
   
   
  -	if(!XMLString::compareString(localname,targetXMLCh))
  +	if(!XMLString::compareString(localname,s_targetXMLCh))
   	{
   		m_startCollectingCharacters = false;
   
  @@ -163,13 +163,13 @@
   								const   Attributes&		attributes)
   {
   	
  -	if(!XMLString::compareString(localname,trans_unitXMLCh))
  +	if(!XMLString::compareString(localname,s_transUnitXMLCh))
   	{
   		// this is an elemente, SAX2Handler class is responsible to handle:
   		// creating Index file, commom for all localization styles
   		SAX2Handler::startElement(uri, localname, qname, attributes);
   	}
  -	else if(!XMLString::compareString(localname,targetXMLCh))
  +	else if(!XMLString::compareString(localname,s_targetXMLCh))
   	{
   
   		
  
  
  
  1.2       +33 -14    xml-xalan/c/src/xalanc/Utils/MsgCreator/InMemHandler.hpp
  
  Index: InMemHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/InMemHandler.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InMemHandler.hpp	2 Dec 2003 19:58:52 -0000	1.1
  +++ InMemHandler.hpp	31 Dec 2003 21:49:56 -0000	1.2
  @@ -60,8 +60,6 @@
   
   #include "SAX2Handler.hpp"
   
  -#include "MsgFileOutputStream.hpp"
  -
   
   XERCES_CPP_NAMESPACE_USE
   
  @@ -73,23 +71,30 @@
       // -----------------------------------------------------------------------
       InMemHandler(const char* fileName);
   
  +    virtual 
       ~InMemHandler();
   
   	// -----------------------------------------------------------------------
       //  Implementations of the SAX DocumentHandler interface
       // -----------------------------------------------------------------------
  -	void endDocument();
  -	void endElement(const XMLCh* const uri,
  +	virtual void 
  +	endDocument();
  +	
  +	virtual void 
  +	endElement(const XMLCh* const ,
   								 const XMLCh* const localname,
  -								 const XMLCh* const qname)	;
  -	void startDocument();
  +								 const XMLCh* const )	;
  +	virtual void 
  +	startDocument();
   
  -	void startElement(const   XMLCh* const    uri,
  +	virtual void 
  +	startElement(const   XMLCh* const    uri,
   									const   XMLCh* const    localname,
   									const   XMLCh* const    qname,
                                       const   Attributes&		attributes);
   
  -	void characters(	const   XMLCh* const    chars
  +	virtual void 
  +	characters(	const   XMLCh* const    chars
   						, const unsigned int    length);
   
   
  @@ -101,20 +106,34 @@
       // -----------------------------------------------------------------------
       //  functions for formatting the output file
       // -----------------------------------------------------------------------
  -	virtual void createHeaderForDataFile ();
  -	virtual void createBottomForDataFile ();
  -
  -	virtual void printBeginOfDataLine ();
  -	virtual void printEndOfDataLine ();
  +	virtual void 
  +	createHeaderForDataFile ();
  +	
  +	virtual void 
  +	createBottomForDataFile ();
  +
  +	virtual void 
  +	printBeginOfDataLine ();
  +	
  +	virtual void 
  +	printEndOfDataLine ();
   
  -	void printToDataFile( const char* sArrayOfStrins[] );
  +	void 
  +	printToDataFile( const char* sArrayOfStrins[] );
   
   
   private:
   
   	bool m_isTheFirstLineInArray;
   
  +	// Not implemented...
  +	InMemHandler&
  +	operator=(const InMemHandler&);
  +
  +	InMemHandler(const InMemHandler&);
   
  +	bool
  +	operator==(const InMemHandler&) const;
   
   };
   
  
  
  
  1.8       +8 -13     xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgCreator.cpp
  
  Index: MsgCreator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgCreator.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MsgCreator.cpp	29 Dec 2003 00:26:54 -0000	1.7
  +++ MsgCreator.cpp	31 Dec 2003 21:49:56 -0000	1.8
  @@ -55,22 +55,17 @@
   * <http://www.apache.org/>.
   */
   
  +#include "ICUResHandler.hpp"
  +#include "InMemHandler.hpp"
  +#include "MsgCreator.hpp"
  +#include "NLSHandler.hpp"
   
  -
  -
  -// ---------------------------------------------------------------------------
  -//  Includes
  -// ---------------------------------------------------------------------------
  -#include <cassert>
  -#include <xercesc/util/PlatformUtils.hpp>
  -#include <xercesc/util/TransService.hpp>
   #include <xercesc/sax2/SAX2XMLReader.hpp>
   #include <xercesc/sax2/XMLReaderFactory.hpp>
  -#include "MsgCreator.hpp"
  -#include "InMemHandler.hpp"
  -#include "ICUResHandler.hpp"
  -#include "NLSHandler.hpp"
  +#include <xercesc/util/PlatformUtils.hpp>
  +#include <xercesc/util/TransService.hpp>
   
  +#include <cassert>
   #if !defined(NDEBUG) && defined(_MSC_VER)
   #include <crtdbg.h>
   #endif
  @@ -463,7 +458,7 @@
   				{
   					try
   					{				
  -						handler->setXML_Lang(theParams.localeName);
  +						handler->setLocale(theParams.localeName);
   	
   						parser->setContentHandler(handler);
   
  
  
  
  1.2       +4 -4      xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgCreator.hpp
  
  Index: MsgCreator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgCreator.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MsgCreator.hpp	29 Dec 2003 00:26:54 -0000	1.1
  +++ MsgCreator.hpp	31 Dec 2003 21:49:56 -0000	1.2
  @@ -60,9 +60,9 @@
   
   #include <xalanc/Include/PlatformDefinitions.hpp>
   
  -// ---------------------------------------------------------------------------
  -//  Includes for all the program files to see
  -// ---------------------------------------------------------------------------
  +#include <xercesc/util/XMLString.hpp>
  +
  +
   #include <cstring>
   #include <cstdlib>
   
  @@ -72,7 +72,7 @@
   #include <iostream>
   #endif
   
  -#include "SAX2Handler.hpp"
  +XERCES_CPP_NAMESPACE_USE
   
   // ---------------------------------------------------------------------------
   //  This is a simple class that lets us do easy (though not terribly efficient)
  
  
  
  1.3       +1 -4      xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp
  
  Index: MsgFileOutputStream.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/MsgFileOutputStream.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MsgFileOutputStream.cpp	2 Dec 2003 22:38:00 -0000	1.2
  +++ MsgFileOutputStream.cpp	31 Dec 2003 21:49:56 -0000	1.3
  @@ -57,14 +57,11 @@
   
   #include "MsgFileOutputStream.hpp"
   
  -#include <cerrno>
  -
   #include <xercesc/util/PlatformUtils.hpp>
  -
   #include <xercesc/util/XMLString.hpp>
   
   #include <cassert>
  -
  +#include <cerrno>
   #include <cstdio>
   
   
  
  
  
  1.5       +1 -2      xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.cpp
  
  Index: NLSHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NLSHandler.cpp	29 Dec 2003 00:26:54 -0000	1.4
  +++ NLSHandler.cpp	31 Dec 2003 21:49:56 -0000	1.5
  @@ -59,9 +59,8 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include "NLSHandler.hpp"
  -
   #include "NLSData.hpp"
  +#include "NLSHandler.hpp"
   
   #include <cstdio>
   
  
  
  
  1.4       +26 -9     xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.hpp
  
  Index: NLSHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/NLSHandler.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NLSHandler.hpp	29 Dec 2003 00:26:54 -0000	1.3
  +++ NLSHandler.hpp	31 Dec 2003 21:49:56 -0000	1.4
  @@ -61,7 +61,6 @@
   #include "ICUResHandler.hpp"
   
   
  -
   XERCES_CPP_NAMESPACE_USE
   
   class NLSHandler : public ICUResHandler 
  @@ -69,28 +68,46 @@
   public:
   	NLSHandler(const char* fileName, bool bCreateUnicode = false);
   
  -	~NLSHandler(void){}
  +	virtual 
  +	~NLSHandler(){}
   
  -	virtual void createHeaderForDataFile ();
  -	virtual void createBottomForDataFile ();
  +	virtual void 
  +	createHeaderForDataFile ();
  +	
  +	virtual void 
  +	createBottomForDataFile ();
   
  -	virtual void printBeginOfDataLine ();
  -	virtual void printEndOfDataLine ();
  +	virtual void 
  +	printBeginOfDataLine ();
  +	
  +	virtual void 
  +	printEndOfDataLine ();
   
  -	void characters(	const   XMLCh* const    chars
  +	void 
  +	characters(	const   XMLCh* const    chars
   						, const unsigned int    length);
  -	void startDocument();
  +	void 
  +	startDocument();
   
   protected:
   
   	// ASCII version of print
  -	void printToDataFileasASCII( const char* sArrayOfStrins[] );
  +	void 
  +	printToDataFileasASCII( const char* sArrayOfStrins[] );
   
   private:
   	int m_RunningNumber;
   	
   	bool m_bCreateUnicode;
   
  +	// Not implemented...
  +	NLSHandler&
  +	operator=(const NLSHandler&);
  +
  +	NLSHandler(const NLSHandler&);
  +
  +	bool
  +	operator==(const NLSHandler&) const;
   };
   
   
  
  
  
  1.5       +21 -94    xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp
  
  Index: SAX2Handler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SAX2Handler.cpp	29 Dec 2003 00:26:54 -0000	1.4
  +++ SAX2Handler.cpp	31 Dec 2003 21:49:56 -0000	1.5
  @@ -62,26 +62,15 @@
   #include <cassert>
   #include <cstdio>
   
  -
  -
  -#include <xercesc/util/XMLUniDefs.hpp>
   #include <xercesc/sax2/Attributes.hpp>
  +#include <xercesc/util/XMLUniDefs.hpp>
   
  -
  -
  -#include "MsgCreator.hpp"
  +#include "ICUResHandler.hpp"
   #include "IndexFileData.hpp"
  +#include "MsgCreator.hpp"
   
   
   
  -// ---------------------------------------------------------------------------
  -//  Local const data
  -//
  -//  Note: This is the 'safe' way to do these strings. If you compiler supports
  -//        L"" style strings, and portability is not a concern, you can use
  -//        those types constants directly.
  -// ---------------------------------------------------------------------------
  -
   static const char* INDEX_FILE_NAME="LocalMsgIndex.hpp";
   
   
  @@ -91,52 +80,21 @@
   // ---------------------------------------------------------------------------
   SAX2Handler::SAX2Handler( ) :
   							m_numberOfRecords(0),
  -							m_XML_lang(0),
  +							m_locale(0),
   							m_startCollectingCharacters(false),
  -							m_fIndexFormatter(INDEX_FILE_NAME)
  +							m_fIndexOutputStream(INDEX_FILE_NAME)
   {
   
   }
   
   SAX2Handler::~SAX2Handler()
   {
  -	if (m_XML_lang != 0)
  -	{
  -		XMLString::release(&m_XML_lang);
  -	}
  -}
  -
  -
  -bool SAX2Handler::translateCharToXMLByteArr ( XMLByte* buffer, int iBufLen, const char*
szSource)const
  -{
  -	bool bResult = false;
  -
  -	if ( iBufLen == 0 || szSource == 0 || buffer == 0 )
  -	{
  -		return bResult;
  -	}
  -	int inpLen = XMLString::stringLen(szSource);
  -
  -	if ( inpLen > iBufLen )
  -	{
  -		buffer[0] = 0;
  -		return bResult;
  -	}
  -
  -
  -	for ( int i = 0; i < inpLen; i++ )
  +	if (m_locale != 0)
   	{
  -		buffer[i] = szSource[i];
  +		XMLString::release(&m_locale);
   	}
  -	buffer[inpLen+1] = 0;
  -	
  -	bResult = true;
  -
  -	return bResult;
   }
   
  -
  -
   void SAX2Handler::createHeaderForIndexFile ()
   {
   	printToIndexFile( szApacheLicense );
  @@ -152,7 +110,6 @@
   	
   void SAX2Handler::printEndOfIndexLine ()
   {
  -//	printToIndexFile ( szEndIndexLine );
   }
   
   
  @@ -168,28 +125,20 @@
   	if ( sArrayOfStrins == NULL)
   		return;
   
  -	XMLByte buffer[1024];
  -	buffer[0] = 0;
  -
  -	for (int i = 0; sArrayOfStrins[i] != NULL; i++){
  -
  -		translateCharToXMLByteArr(buffer, 1024, sArrayOfStrins[i]);
  -
  -
  -		m_fIndexFormatter.writeChars(buffer,XMLString::stringLen(sArrayOfStrins[i] ),NULL);
  -		m_fIndexFormatter.flush();
  -
  +	for (int i = 0; sArrayOfStrins[i] != NULL; i++)
  +	{
  +		m_fIndexOutputStream.writeAsASCII(sArrayOfStrins[i],XMLString::stringLen(sArrayOfStrins[i]));
   	}
   }
   
   
   
  -void SAX2Handler::startElement(const   XMLCh* const    uri,
  +void SAX2Handler::startElement(const   XMLCh* const    ,
   									const   XMLCh* const    localname,
  -									const   XMLCh* const    qname,
  +									const   XMLCh* const    ,
                                       const   Attributes&		attributes)
   {
  -	if(!XMLString::compareString(localname,trans_unitXMLCh))
  +	if(!XMLString::compareString(localname,s_transUnitXMLCh))
   	{
   		unsigned int len = attributes.getLength();
   		
  @@ -199,45 +148,23 @@
   		{
   			const XMLCh* name = attributes.getQName(index) ;
   			
  -			if (name != NULL && !XMLString::compareString(name,idXMLCh)	)
  +			if (name != NULL && !XMLString::compareString(name,s_idXMLCh)	)
   			{
   				const XMLCh* val = attributes.getValue(index);
   				if ( val != NULL )
   				{
   					if ( m_numberOfRecords != 1)
   						printBeginOfIndexLine();
  -					
  -					int valLen = XMLString::stringLen(val);
  -					
  -					
  -					char* szTempString = XMLString::transcode(val);
  -					
  -					XMLByte* xmlByteBufferPtr = new XMLByte[valLen+10];
  -					
  -					translateCharToXMLByteArr(xmlByteBufferPtr, valLen, szTempString);
  -					
  -					m_fIndexFormatter.writeChars(xmlByteBufferPtr,XMLString::stringLen(szTempString),NULL);
  -					
  -					m_fIndexFormatter.flush();
  -					
  -					XMLString::release( &szTempString );
  -					delete[] xmlByteBufferPtr;
  -					
  +										
  +					m_fIndexOutputStream.writeAsASCII(val,XMLString::stringLen(val));
   					
   					char buff[100];
  -					XMLByte xmlByteBuffer[100];
   					
   					sprintf( buff, "		 = %d \n",(m_numberOfRecords - 1));
   					
  -					translateCharToXMLByteArr(xmlByteBuffer, 100, buff);
  -					
  -					m_fIndexFormatter.writeChars(xmlByteBuffer,XMLString::stringLen(buff),NULL);
  -					
  -					m_fIndexFormatter.flush();
  +					m_fIndexOutputStream.writeAsASCII(buff,XMLString::stringLen(buff));
   					
   					printEndOfIndexLine ();
  -					
  -					
   				}
   			}
   			
  @@ -280,16 +207,16 @@
   }
   
   
  -void SAX2Handler::setXML_Lang( const char* localName)
  +void SAX2Handler::setLocale( const char* localName)
   {
   	assert(localName != 0);
   
  -	if (m_XML_lang != 0)
  +	if (m_locale != 0)
   	{
  -		XMLString::release(&m_XML_lang);
  +		XMLString::release(&m_locale);
   	}
   
  -	m_XML_lang = XMLString::transcode(localName);
  +	m_locale = XMLString::transcode(localName);
   }
   
   
  
  
  
  1.4       +61 -40    xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp
  
  Index: SAX2Handler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Utils/MsgCreator/SAX2Handler.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SAX2Handler.hpp	29 Dec 2003 00:26:54 -0000	1.3
  +++ SAX2Handler.hpp	31 Dec 2003 21:49:56 -0000	1.4
  @@ -58,16 +58,17 @@
   #if !defined(SAX2HANDLER_MSGCREATOR_1357924680)
   #define SAX2HANDLER_MSGCREATOR_1357924680
   
  +#include "MsgFileOutputStream.hpp"
   
  -#include    <xercesc/sax2/DefaultHandler.hpp>
  -#include <xercesc/framework/LocalFileFormatTarget.hpp>
  +#include <xercesc/sax2/DefaultHandler.hpp>
   #include <xercesc/util/XMLUniDefs.hpp>
   
  +
   XERCES_CPP_NAMESPACE_USE
   
   
   
  -static const XMLCh trans_unitXMLCh[] = 
  +static const XMLCh s_transUnitXMLCh[] = 
   { 
   	chLatin_t, 
   	chLatin_r,
  @@ -84,7 +85,7 @@
   };
   
   
  -static const XMLCh sourceXMLCh[] = 
  +static const XMLCh s_sourceXMLCh[] = 
   { 
   	chLatin_s, 
   	chLatin_o,
  @@ -97,7 +98,7 @@
   };
   
   
  -static const XMLCh targetXMLCh[] = 
  +static const XMLCh s_targetXMLCh[] = 
   { 
   	chLatin_t, 
   	chLatin_a,
  @@ -110,7 +111,7 @@
   };
   
   
  -static const XMLCh xml_LangXMLCh[] = 
  +static const XMLCh s_xmlLangXMLCh[] = 
   { 
   	chLatin_x, 
   	chLatin_m,
  @@ -125,14 +126,14 @@
   
   
   
  -static const XMLCh idXMLCh[] =
  +static const XMLCh s_idXMLCh[] =
   {
   	chLatin_i,
   	chLatin_d,
   	chNull
   };
   
  -static const XMLCh textXMLCh[] = 
  +static const XMLCh s_textXMLCh[] = 
   { 
   	chLatin_T, 
   	chLatin_e, 
  @@ -140,64 +141,78 @@
   	chLatin_t, 
   	chNull
   };
  +
  +
   // Common class for the all system: creates index file ( common for all localization systems)
   // For creation data file responsible subclasses
   
   
  -class SAX2Handler : public DefaultHandler, public XMLFormatTarget
  +class SAX2Handler : public DefaultHandler
   {
   public:
       // -----------------------------------------------------------------------
       //  Constructors
       // -----------------------------------------------------------------------
       SAX2Handler();
  -    ~SAX2Handler();
  +    virtual ~SAX2Handler();
   
   public:
  -    void startElement(const   XMLCh* const    uri,
  +    virtual void 
  +    startElement(const   XMLCh* const    ,
   									const   XMLCh* const    localname,
  -									const   XMLCh* const    qname,
  +									const   XMLCh* const    ,
                                       const   Attributes&		attributes);
   
  -	void startDocument();
  +	virtual void 
  +	startDocument();
   
  -	void endDocument();
  +	virtual void 
  +	endDocument();
   
      // -----------------------------------------------------------------------
       //  Implementations of the SAX ErrorHandler interface
       // -----------------------------------------------------------------------
  -	void error(const SAXParseException& e);
  -	void fatalError(const SAXParseException& e);
  -	void warning(const SAXParseException& e);
  -
  -    virtual void writeChars
  -				(
  -					  const XMLByte* const      toWrite
  -					, const unsigned int        count
  -					,       XMLFormatter* const formatter
  -					){};
  +	virtual void 
  +	error(const SAXParseException& e); 
  +	
  +	virtual void 
  +	fatalError(const SAXParseException& e);
  +	
  +	virtual void 
  +	warning(const SAXParseException& e);
   
  -	void setXML_Lang( const char* localName);
  +	void 
  +	setLocale( const char* localeName);
   
   	const XMLCh*
  -	getXML_lang () const
  +	getLocale () const
   	{
  -		return m_XML_lang;
  +		return m_locale;
   	}
   
   protected:
   	bool translateCharToXMLByteArr ( XMLByte* buffer, int iBufLen, const char* szSource)const;
   
  -	virtual void createHeaderForDataFile ()=0;
  -	virtual void createBottomForDataFile ()=0;
  -
  -	virtual void printBeginOfDataLine ()=0;
  -	virtual void printEndOfDataLine ()=0;
  +	virtual void 
  +	createHeaderForDataFile ()=0;
  +	
  +	virtual void 
  +	createBottomForDataFile ()=0;
  +
  +	virtual void 
  +	printBeginOfDataLine ()=0;
  +	
  +	virtual void 
  +	printEndOfDataLine ()=0;
  +
  +	virtual void 
  +	printToDataFile( const char* sArrayOfStrins[] ) = 0;
  +	
  +	void 
  +	printToIndexFile( const char* sArrayOfStrins[] );
   
  -	virtual void printToDataFile( const char* sArrayOfStrins[] ) = 0;
  -	void printToIndexFile( const char* sArrayOfStrins[] );
  -
  -	void printNumbOfRecords ();
  +	void 
  +	printNumbOfRecords ();
   
   
   
  @@ -212,9 +227,7 @@
   protected :
   	int	m_numberOfRecords;
   
  -	// Name of asked locale. Usially two code points, for example from local
  -	// name en_US "XML_lang" will be "en"
  -	XMLCh* m_XML_lang;
  +	XMLCh* m_locale;
   
   	bool m_startCollectingCharacters;
   
  @@ -224,8 +237,16 @@
       // -----------------------------------------------------------------------
   
   private:
  -	LocalFileFormatTarget    m_fIndexFormatter;
  +	XalanFileOutputStream    m_fIndexOutputStream;
  +
  +	// Not implemented...
  +	SAX2Handler&
  +	operator=(const SAX2Handler&);
  +
  +	SAX2Handler(const SAX2Handler&);
   
  +	bool
  +	operator==(const SAX2Handler&) const;
   
   };
   
  
  
  

---------------------------------------------------------------------
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