List:Commits« Previous MessageNext Message »
From:pharvey Date:January 8 2006 1:24am
Subject:Connector/ODBC 5 commit: r34 - in MYODBCDbg: MYODBCDbgLib include
View as plain text  
Modified:
   MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp
   MYODBCDbg/include/MYODBCDbg.h
Log:
UNICODE:
- make debug output easier to read

Modified: MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp
===================================================================
--- MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp	2006-01-07 18:04:33 UTC (rev 33)
+++ MYODBCDbg/MYODBCDbgLib/MYODBCDbg.cpp	2006-01-08 01:24:26 UTC (rev 34)
@@ -28,6 +28,18 @@
 */
 #include "../include/MYODBCDbg.h"
 
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
 MYODBCDbg *gpMYODBCDbg = NULL;
 
 /*! 
@@ -48,24 +60,72 @@
     nNestLevel = 0;
 }
 
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
 MYODBCDbg::MYODBCDbg( FILE * fileHandle )
     : QTextStream( fileHandle, QIODevice::WriteOnly )
 {
     nNestLevel = 0;
 }
 
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
 MYODBCDbg::MYODBCDbg( QString * string )
     : QTextStream( string, QIODevice::WriteOnly )
 {
     nNestLevel = 0;
 }
 
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
 MYODBCDbg::MYODBCDbg( QByteArray * array )
     : QTextStream( array, QIODevice::WriteOnly )
 {
     nNestLevel = 0;
 }
 
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
 MYODBCDbg::MYODBCDbg( const QByteArray & array )
     : QTextStream( array, QIODevice::WriteOnly )
 {
@@ -85,13 +145,13 @@
     \sa     ZZZZ
             ZZZZ
 */
-void MYODBCDbg::doEnter( const char *pszFile, int nLine, const char *pszFunction )
+void MYODBCDbg::doEnter( const char *pszFile, int nLine, const char *pszFunction, const
QString &stringMessage )
 {
     doNestLevel();
     *this << QString( "[ENTER  ] %1:%2: %3 " )
                 .arg( pszFile )
                 .arg( nLine )
-                .arg( pszFunction ) << endl;
+                .arg( pszFunction ) << stringMessage << endl;
     nNestLevel++;
 }
 
@@ -100,32 +160,127 @@
                 
             ZZZZ
             
-    \param  nRetuen     ZZZZ
-    \param  pszFunction ZZZZ
-    \param  pszFile     ZZZZ
-    \param  nLine       ZZZZ
+    \param  ZZZZ
+
+    \return ZZZZ
     
+    \sa     ZZZZ
+            ZZZZ
+*/
+void MYODBCDbg::doInfo( const char *pszFile, int nLine, const char *pszFunction, const
QString &stringMessage )
+{
+    doNestLevel();
+    *this << QString( "[INFO   ] %1:%2: %3 " )
+                .arg( pszFile )
+                .arg( nLine )
+                .arg( pszFunction ) << stringMessage << endl;
+}
+
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
     \return ZZZZ
     
     \sa     ZZZZ
             ZZZZ
 */
-SQLRETURN MYODBCDbg::doReturn( const char *pszFile, int nLine, const char *pszFunction,
SQLRETURN nReturn )
+void MYODBCDbg::doWarning( const char *pszFile, int nLine, const char *pszFunction, const
QString &stringMessage )
 {
     doNestLevel();
+    *this << QString( "[WARNING] %1:%2: %3 " )
+                .arg( pszFile )
+                .arg( nLine )
+                .arg( pszFunction ) << stringMessage << endl;
+}
+
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
+void MYODBCDbg::doError( const char *pszFile, int nLine, const char *pszFunction, const
QString &stringMessage )
+{
+    doNestLevel();
+    *this << QString( "[ERROR  ] %1:%2: %3 " )
+                .arg( pszFile )
+                .arg( nLine )
+                .arg( pszFunction ) << stringMessage << endl;
+}
+
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
+void MYODBCDbg::doReturn( const char *pszFile, int nLine, const char *pszFunction, const
QString &stringMessage )
+{
+    nNestLevel--;
+    doNestLevel();
     *this << QString( "[RETURN ] %1:%2: %3 " )
                 .arg( pszFile )
                 .arg( nLine )
-                .arg( pszFunction ) << getReturnString( nReturn ) <<  endl;
+                .arg( pszFunction ) << stringMessage << endl;
+}
+
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
+SQLRETURN MYODBCDbg::doReturn( const char *pszFile, int nLine, const char *pszFunction,
SQLRETURN nReturn, const QString &stringMessage )
+{
     nNestLevel--;
+    doNestLevel();
+    *this << QString( "[RETURN ] %1:%2: %3 " )
+                .arg( pszFile )
+                .arg( nLine )
+                .arg( pszFunction ) << getReturnString( nReturn ) <<  " "
<< stringMessage << endl;
     return nReturn;
 }
 
+/*! 
+    \brief  ZZZZ
+                
+            ZZZZ
+            
+    \param  ZZZZ
+
+    \return ZZZZ
+    
+    \sa     ZZZZ
+            ZZZZ
+*/
+
 void MYODBCDbg::doNestLevel()
 {
     for ( int n = 0; n < nNestLevel; n++ )
     {
-        *this << " ";
+        *this << "|\t";
     }
 }
 

Modified: MYODBCDbg/include/MYODBCDbg.h
===================================================================
--- MYODBCDbg/include/MYODBCDbg.h	2006-01-07 18:04:33 UTC (rev 33)
+++ MYODBCDbg/include/MYODBCDbg.h	2006-01-08 01:24:26 UTC (rev 34)
@@ -45,8 +45,12 @@
     MYODBCDbg( QByteArray * array );
     MYODBCDbg( const QByteArray & array );
 
-    void doEnter( const char *pszFile, int nLine, const char *pszFunction );
-    SQLRETURN doReturn( const char *pszFile, int nLine, const char *pszFunction,
SQLRETURN nReturn );
+    void doEnter( const char *pszFile, int nLine, const char *pszFunction, const QString
&stringMessage = QString::null );
+    void doInfo( const char *pszFile, int nLine, const char *pszFunction, const QString
&stringMessage = QString::null );
+    void doWarning( const char *pszFile, int nLine, const char *pszFunction, const
QString &stringMessage = QString::null );
+    void doError( const char *pszFile, int nLine, const char *pszFunction, const QString
&stringMessage = QString::null );
+    void doReturn( const char *pszFile, int nLine, const char *pszFunction, const QString
&stringMessage = QString::null );
+    SQLRETURN doReturn( const char *pszFile, int nLine, const char *pszFunction,
SQLRETURN nReturn, const QString &stringMessage = QString::null );
 
     virtual void doNestLevel();
 
@@ -131,13 +135,8 @@
 {\
 if ( gpMYODBCDbg )\
 {\
-    QString stringHeader = QString( "[INFO   ] %1:%2: %3 " )\
-                            .arg( __FILE__ )\
-                            .arg( __LINE__ )\
-                            .arg( __FUNCTION__ );\
-    QString stringMessage = QString( A )\
-                            .arg( B );\
-    *gpMYODBCDbg << stringHeader << stringMessage << endl;\
+    QString stringMessage;\
+    gpMYODBCDbg->doInfo( __FILE__, __LINE__, __FUNCTION__, stringMessage.sprintf( A, B
) );\
 }\
 }
 
@@ -145,13 +144,8 @@
 {\
 if ( gpMYODBCDbg )\
 {\
-    QString stringHeader = QString( "[ERROR  ] %1:%2: %3 " )\
-                            .arg( __FILE__ )\
-                            .arg( __LINE__ )\
-                            .arg( __FUNCTION__ );\
-    QString stringMessage = QString( A )\
-                            .arg( B );\
-    *gpMYODBCDbg << stringHeader << stringMessage << endl;\
+    QString stringMessage;\
+    gpMYODBCDbg->doError( __FILE__, __LINE__, __FUNCTION__, stringMessage.sprintf( A,
B ) );\
 }\
 }
 
@@ -159,13 +153,8 @@
 {\
 if ( gpMYODBCDbg )\
 {\
-    QString stringHeader = QString( "[WARNING] %1:%2: %3 " )\
-                            .arg( __FILE__ )\
-                            .arg( __LINE__ )\
-                            .arg( __FUNCTION__ );\
-    QString stringMessage = QString( A )\
-                            .arg( B );\
-    *gpMYODBCDbg << stringHeader << stringMessage << endl;\
+    QString stringMessage;\
+    gpMYODBCDbg->doWarning( __FILE__, __LINE__, __FUNCTION__, stringMessage.sprintf(
A, B ) );\
 }\
 }
 
@@ -179,17 +168,20 @@
             
     \sa     MYODBCDbgEnter MYODBC_PRINT            
 */
-#define MYODBCDbgReturn(A) return(gpMYODBCDbg ? gpMYODBCDbg->doReturn( __FILE__,
__LINE__, __FUNCTION__, A ) : A)
+#define MYODBCDbgReturn(A)\
+{\
+if ( gpMYODBCDbg )\
+{\
+    return gpMYODBCDbg->doReturn( __FILE__, __LINE__, __FUNCTION__, A );\
+}\
+return A;\
+}
 
 #define MYODBCDbgReturn2()\
 {\
 if ( gpMYODBCDbg )\
 {\
-    QString stringHeader = QString( "[RETURN ] %1:%2: %3 " )\
-                            .arg( __FILE__ )\
-                            .arg( __LINE__ )\
-                            .arg( __FUNCTION__ );\
-    *gpMYODBCDbg << stringHeader << endl;\
+    gpMYODBCDbg->doReturn( __FILE__, __LINE__, __FUNCTION__ );\
 }\
 }
 
@@ -198,11 +190,7 @@
 if ( gpMYODBCDbg )\
 {\
     QString stringMessage;\
-    QString stringHeader = QString( "[RETURN ] %1:%2: %3 " )\
-                            .arg( __FILE__ )\
-                            .arg( __LINE__ )\
-                            .arg( __FUNCTION__ );\
-    *gpMYODBCDbg << stringHeader << stringMessage.sprintf( A, B ) <<
endl;\
+    gpMYODBCDbg->doReturn( __FILE__, __LINE__, __FUNCTION__, stringMessage.sprintf( A,
B ) );\
 }\
 return ( B );\
 }

Thread
Connector/ODBC 5 commit: r34 - in MYODBCDbg: MYODBCDbgLib includepharvey8 Jan