backupandrestore/backupengine/src/sbeparserproxy.cpp
changeset 49 c20dd21d1eb4
parent 0 d0791faffa3f
--- a/backupandrestore/backupengine/src/sbeparserproxy.cpp	Fri Aug 20 17:43:33 2010 +0800
+++ b/backupandrestore/backupengine/src/sbeparserproxy.cpp	Fri Sep 03 18:38:04 2010 +0800
@@ -25,7 +25,11 @@
 
 // User includes
 #include "sbeparserdefs.h"
-#include "sblog.h"
+#include "OstTraceDefinitions.h"
+#include "sbtrace.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sbeparserproxyTraces.h"
+#endif
 
 namespace conn
 	{
@@ -37,27 +41,34 @@
 	@param apDataOwnerManager data owner manager to access resources
 	*/
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_CSBEPARSERPROXY_CONS_ENTRY );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_CSBEPARSERPROXY_CONS_EXIT );
 		}
 
 	CSBEParserProxy::~CSBEParserProxy()
 	/** Standard C++ destructor
 	*/
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_CSBEPARSERPROXY_DES_ENTRY );
 		delete iConverter;
 		delete iParser;
+		OstTraceFunctionExit0( CSBEPARSERPROXY_CSBEPARSERPROXY_DES_EXIT );
 		}
 
 	void CSBEParserProxy::ConstructL()
 	/** Symbian 2nd stage constructor */
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_CONSTRUCTL_ENTRY );
 		iParser = CParser::NewL(KMimeType, *this);
 
 		// We only convert from UTF-8 to UTF-16
 		iConverter = CCnvCharacterSetConverter::NewL();
 		if  ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iFsSession ) == CCnvCharacterSetConverter::ENotAvailable )
 			{
+		    OstTrace0(TRACE_ERROR, CSBEPARSERPROXY_CONSTRUCTL, "Leave: KErrNotFound");
 			User::Leave(KErrNotFound);
 			}
+		OstTraceFunctionExit0( CSBEPARSERPROXY_CONSTRUCTL_EXIT );
 		}
 		
 	CSBEParserProxy* CSBEParserProxy::NewL( RFs& aFsSession )
@@ -68,17 +79,20 @@
 	@return a CBackupRegistrationParser object
 	*/
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_NEWL_ENTRY );
 		CSBEParserProxy* self = new(ELeave) CSBEParserProxy( aFsSession );
 		CleanupStack::PushL(self);
 		self->ConstructL();
 		CleanupStack::Pop(self);
 
+		OstTraceFunctionExit0( CSBEPARSERPROXY_NEWL_EXIT );
 		return self;
 		}
 
 	void CSBEParserProxy::ParseL( const TDesC& aFileName, MContentHandler& aObserver )
 	/** Parsing API */
         {
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_PARSEL_ENTRY );
         // Store transient observer (the entity that we will route callbacks to)
         iTransientParsingError = KErrNone;
         iTransientObserver = &aObserver;
@@ -88,23 +102,24 @@
 		Xml::ParseL( *iParser, iFsSession, aFileName );
 
         // Handle any errors received during callbacks
-		User::LeaveIfError( iTransientParsingError );
+		LEAVEIFERROR( iTransientParsingError, OstTrace1(TRACE_ERROR, DUP1_CSBEPARSERPROXY_CONVERTTOUNICODEL, "Leave: %d", iTransientParsingError) );
+        OstTraceFunctionExit0( CSBEPARSERPROXY_PARSEL_EXIT );
         }
 
 	TInt CSBEParserProxy::ConvertToUnicodeL( TDes16& aUnicode, const TDesC8& aForeign )
         {
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_CONVERTTOUNICODEL_ENTRY );
         const TInt error = iConverter->ConvertToUnicode( aUnicode, aForeign, iConverterState );
 
-#ifdef SBE_LOGGING_ENABLED
         if  ( error != KErrNone )
             {
             HBufC* copy = HBufC::NewL( aForeign.Length() * 2 );
             copy->Des().Copy( aForeign );
-			__LOG2("CSBEParserProxy::ConvertToUnicode() - error: %d when converting: %S", error, copy );
+            OstTraceExt2(TRACE_NORMAL, CSBEPARSERPROXY_CONVERTTOUNICODEL, "error: %d when converting: %S", error, *copy );
             delete copy;
             }
-#endif
 
+        OstTraceFunctionExit0( CSBEPARSERPROXY_CONVERTTOUNICODEL_EXIT );
         return error;
         }
 		
@@ -116,27 +131,31 @@
 	*/
 	void CSBEParserProxy::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode)
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_ONSTARTDOCUMENTL_ENTRY );
 		if (aErrorCode != KErrNone)
 			{
-			__LOG1("CBackupRegistrationParser::OnStartDocumentL() - error = %d", aErrorCode);
+		    OstTrace1(TRACE_ERROR, CSBEPARSERPROXY_ONSTARTDOCUMENTL, "error = %d", aErrorCode);
 			User::Leave(aErrorCode);
 			}
 
         iTransientObserver->OnStartDocumentL( aDocParam, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONSTARTDOCUMENTL_EXIT );
 		}
 		
 	/** MContentHandler::OnEndDocumentL()
 	*/
 	void CSBEParserProxy::OnEndDocumentL(TInt aErrorCode)
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_ONENDDOCUMENTL_ENTRY );
 		if (aErrorCode != KErrNone)
 			{
 			// just to satifsy UREL compiler
 			(void) aErrorCode;
-			__LOG1("CBackupRegistrationParser::OnEndDocumentL() - error = %d", aErrorCode);
+			OstTrace1(TRACE_NORMAL, CSBEPARSERPROXY_ONENDDOCUMENTL, "error = %d", aErrorCode);
 			}
 
         iTransientObserver->OnEndDocumentL( aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONENDDOCUMENTL_EXIT );
 		}
 		
 	/** MContentHandler::OnStartElementL()
@@ -145,68 +164,83 @@
 	*/		
 	void CSBEParserProxy::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode)
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_ONSTARTELEMENTL_ENTRY );
 		if (aErrorCode != KErrNone)
 			{
-			__LOG1("CBackupRegistrationParser::OnStartElementL() - error = %d", aErrorCode);
-			User::LeaveIfError(aErrorCode);
+			LEAVEIFERROR(aErrorCode, OstTrace1(TRACE_ERROR, CSBEPARSERPROXY_ONSTARTELEMENTL, "error = %d", aErrorCode));
 			}
 
         iTransientObserver->OnStartElementL( aElement, aAttributes, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONSTARTELEMENTL_EXIT );
 		}
 
 	/** MContentHandler::OnEndElementL()
 	*/
 	void CSBEParserProxy::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
 		{
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_ONENDELEMENTL_ENTRY );
 		if (aErrorCode != KErrNone)
 			{
-			__LOG1("CBackupRegistrationParser::OnEndElementL() - error = %d", aErrorCode);
+		    OstTrace1(TRACE_ERROR, CSBEPARSERPROXY_ONENDELEMENTL, "error = %d", aErrorCode);
 			User::Leave(aErrorCode);
 			}
 
         iTransientObserver->OnEndElementL( aElement, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONENDELEMENTL_EXIT );
 		}
 
 	/** MContentHandler::OnContentL()
 	*/
 	void CSBEParserProxy::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
 		{
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_ONCONTENTL_ENTRY );
         iTransientObserver->OnContentL( aBytes, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONCONTENTL_EXIT );
 		}
 
 	/** MContentHandler::OnStartPrefixMappingL()
 	*/
 	void CSBEParserProxy::OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode)
 		{
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_ONSTARTPREFIXMAPPINGL_ENTRY );
         iTransientObserver->OnStartPrefixMappingL( aPrefix, aUri, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONSTARTPREFIXMAPPINGL_EXIT );
 		}
 
 	/** MContentHandler::OnEndPrefixMappingL()
 	*/
 	void CSBEParserProxy::OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode)
 		{
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_ONENDPREFIXMAPPINGL_ENTRY );
         iTransientObserver->OnEndPrefixMappingL( aPrefix, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONENDPREFIXMAPPINGL_EXIT );
 		}
 
 	/** MContentHandler::OnIgnorableWhiteSpaceL()
 	*/
 	void CSBEParserProxy::OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode)
 		{
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_ONIGNORABLEWHITESPACEL_ENTRY );
         iTransientObserver->OnIgnorableWhiteSpaceL( aBytes, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONIGNORABLEWHITESPACEL_EXIT );
 		}
 
 	/** MContentHandler::OnSkippedEntityL()
 	*/
 	void CSBEParserProxy::OnSkippedEntityL(const RString& aName, TInt aErrorCode)
 		{
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_ONSKIPPEDENTITYL_ENTRY );
         iTransientObserver->OnSkippedEntityL( aName, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONSKIPPEDENTITYL_EXIT );
 		}
 
 	/** MContentHandler::OnProcessingInstructionL()
 	*/
 	void CSBEParserProxy::OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode)
 		{
+        OstTraceFunctionEntry0( CSBEPARSERPROXY_ONPROCESSINGINSTRUCTIONL_ENTRY );
         iTransientObserver->OnProcessingInstructionL( aTarget, aData, aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONPROCESSINGINSTRUCTIONL_EXIT );
 		}
 
 	/** MContentHandler::OnError()
@@ -215,9 +249,11 @@
 	*/
 	void CSBEParserProxy::OnError(TInt aErrorCode)
 		{
-		__LOG1("CBackupRegistrationParser::OnError() - error = %d", aErrorCode);
+		OstTraceFunctionEntry0( CSBEPARSERPROXY_ONERROR_ENTRY );
+		OstTrace1(TRACE_NORMAL, CSBEPARSERPROXY_ONERROR, "error = %d", aErrorCode);
 		iTransientParsingError = aErrorCode;
         iTransientObserver->OnError( aErrorCode );
+		OstTraceFunctionExit0( CSBEPARSERPROXY_ONERROR_EXIT );
 		}
 
 	/** MContentHandler::OnEndPrefixMappingL()