webengine/osswebengine/WebKit/s60/misc/WebKitLogger.h
changeset 0 dd21522fd290
child 48 79859ed3eea9
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 #ifndef WEBKITLOGGER_H
       
    18 #define WEBKITLOGGER_H
       
    19 
       
    20 //  INCLUDES
       
    21 #include <e32base.h>
       
    22 #include <w32std.h>
       
    23 #include <flogger.h>
       
    24 #include "staticobjectscontainer.h"
       
    25 // CONSTANTS
       
    26 
       
    27 // MACROS
       
    28 
       
    29 // DATA TYPES
       
    30 
       
    31 // FUNCTION PROTOTYPES
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 
       
    38 class LogStream;
       
    39 
       
    40 LogStream & flush(LogStream& stream);
       
    41 LogStream & mem(LogStream& stream);
       
    42 
       
    43 /**
       
    44 *
       
    45 *  @lib resLoader.lib
       
    46 *  @since 3.0
       
    47 */
       
    48 class LogStream 
       
    49     {
       
    50     public:
       
    51         LogStream();
       
    52         LogStream& operator<<(TInt aInt );
       
    53         LogStream& operator<<(TUint aUint );
       
    54         LogStream& operator<<(TReal);
       
    55         LogStream& operator<<(const char* aString );
       
    56         LogStream& operator<<(const TDesC& aString );
       
    57         LogStream& operator<<(const TDesC8& );
       
    58         LogStream& operator<<(void *);
       
    59 
       
    60         // LogStream& operator<<(const LogStreamManipulator& );
       
    61         void flush();
       
    62         void mem();
       
    63 
       
    64     private:
       
    65 
       
    66         TBuf8<1024>  iString;
       
    67         TBool iLoggerReady;
       
    68     };
       
    69 
       
    70 /**
       
    71 *
       
    72 *  @lib resLoader.lib
       
    73 *  @since 3.0
       
    74 */
       
    75 class TWebKitDebugStream;
       
    76 
       
    77 typedef TWebKitDebugStream &  (*DEBUGFUNC)( TWebKitDebugStream& );
       
    78 
       
    79 class TWebKitDebugStream
       
    80     {
       
    81     public:
       
    82 
       
    83 #if ( defined(__WINSCW__) || defined(PERF_REGRESSION_LOG) )
       
    84         TWebKitDebugStream& operator<<( TInt aInt ) { WebCore::StaticObjectsContainer::instance()->logStream()<<aInt; return *this; }
       
    85         TWebKitDebugStream& operator<<( TUint aUint ) { WebCore::StaticObjectsContainer::instance()->logStream()<<aUint; return *this; }
       
    86         TWebKitDebugStream& operator<<( TReal aReal ) { WebCore::StaticObjectsContainer::instance()->logStream()<<aReal; return *this; }
       
    87         TWebKitDebugStream& operator<<( const char* aString ) { WebCore::StaticObjectsContainer::instance()->logStream()<<aString; return *this; }
       
    88         TWebKitDebugStream& operator<<( const TAny* aAny ) { WebCore::StaticObjectsContainer::instance()->logStream()<<(void*)aAny; return *this; }
       
    89         TWebKitDebugStream& operator<<( const TDesC& aString ) { WebCore::StaticObjectsContainer::instance()->logStream()<<aString; return *this; }
       
    90         TWebKitDebugStream& operator<<( const TDesC8& aString ) { WebCore::StaticObjectsContainer::instance()->logStream()<<aString; return *this; }
       
    91         TWebKitDebugStream& operator<<( DEBUGFUNC aFN ) { aFN(*this); return *this; }
       
    92 #else
       
    93         TWebKitDebugStream& operator<<( TInt aInt ) { return *this; }
       
    94         TWebKitDebugStream& operator<<( TUint aUint ) { return *this; }
       
    95         TWebKitDebugStream& operator<<( TReal aReal ) { return *this; }
       
    96         TWebKitDebugStream& operator<<( const char* aString ) { return *this; }
       
    97         TWebKitDebugStream& operator<<( const TAny* aAny ) { return *this; }
       
    98         TWebKitDebugStream& operator<<( const TDesC& aString ) { return *this; }
       
    99         TWebKitDebugStream& operator<<( const TDesC8& aString ) { return *this; }
       
   100         TWebKitDebugStream& operator<<( DEBUGFUNC aFN )     { return *this; }
       
   101 #endif
       
   102 };
       
   103 
       
   104 #if ( defined(__WINSCW__) || defined(PERF_REGRESSION_LOG) )
       
   105 inline TWebKitDebugStream& flush(TWebKitDebugStream& s) { flush(WebCore::StaticObjectsContainer::instance()->logStream()); return s; }
       
   106 inline TWebKitDebugStream& mem(TWebKitDebugStream& s) { mem(WebCore::StaticObjectsContainer::instance()->logStream()); return s; }
       
   107 #else
       
   108 inline TWebKitDebugStream& flush(TWebKitDebugStream& s) { return s; }
       
   109 inline TWebKitDebugStream& mem(TWebKitDebugStream& s) { return s; }
       
   110 #endif
       
   111 
       
   112 inline TWebKitDebugStream wkDebug() { return TWebKitDebugStream(); }
       
   113 
       
   114 #endif // WEBKITLOGGER_H