skins/AknSkins/inc/AknsDebug.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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 "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:  Contains internal debug macros and enumerations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef AKNSDEBUG_H
       
    20 #define AKNSDEBUG_H
       
    21 
       
    22 // MACROS
       
    23 
       
    24 // If AKNS_TRACING_ENABLED is defined, tracing will be enabled (all levels)
       
    25 //
       
    26 // Alternatively, the following macros can be used to enable traces:
       
    27 //  AKNS_TRACING_ENABLED_INFO   Informative traces
       
    28 //  AKNS_TRACING_ENABLED_NORMAL Normal traces
       
    29 //  AKNS_TRACING_ENABLED_ERROR  Error traces
       
    30 // Default for debug builds is NORMAL and ERROR
       
    31 
       
    32 #if defined(_DEBUG)
       
    33 #define AKNS_TRACING_ENABLED_NORMAL
       
    34 #define AKNS_TRACING_ENABLED_ERROR
       
    35 #endif
       
    36 
       
    37 #if defined(AKNS_TRACING_ENABLED)
       
    38 #undef AKNS_TRACING_ENABLED_INFO
       
    39 #define AKNS_TRACING_ENABLED_INFO
       
    40 #undef AKNS_TRACING_ENABLED_NORMAL
       
    41 #define AKNS_TRACING_ENABLED_NORMAL
       
    42 #undef AKNS_TRACING_ENABLED_ERROR
       
    43 #define AKNS_TRACING_ENABLED_ERROR
       
    44 #endif
       
    45 
       
    46 #if defined(AKNS_TRACING_ENABLED_INFO) || defined(AKNS_TRACING_ENABLED_NORMAL) || defined(AKNS_TRACING_ENABLED_ERROR)
       
    47 #if !defined(__E32SVR_H__)
       
    48 #include <e32svr.h>
       
    49 #endif
       
    50 #define AKNS_TRACECMDPFX RDebug::Print
       
    51 #define AKNS_TRACECMDSFX
       
    52 #define AKNS_TRACE_ADDPREFIX(aText) (TPtrC((const TText *)L"AKNSKINS: \"" L##aText L"\""))
       
    53 #endif
       
    54 
       
    55 #if defined(AKNS_TRACING_ENABLED_INFO)
       
    56 #pragma message("AknsDebug: Info-mode tracing is enabled, performance will be degraded!")
       
    57 #define AKNS_TRACE_ADDPREFIX_INFO(aText) (TPtrC((const TText *)L"AKNSKINS: (Info) \"" L##aText L"\""))
       
    58 #define AKNS_TRACE_INFO(aMsg) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_INFO(aMsg) ) AKNS_TRACECMDSFX
       
    59 #define AKNS_TRACE_INFO1(aFormat,aP1) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_INFO(aFormat),(aP1) ) AKNS_TRACECMDSFX
       
    60 #define AKNS_TRACE_INFO2(aFormat,aP1,aP2) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_INFO(aFormat),(aP1),(aP2) ) AKNS_TRACECMDSFX
       
    61 #define AKNS_TRACE_INFO3(aFormat,aP1,aP2,aP3) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_INFO(aFormat),(aP1),(aP2),(aP3) ) AKNS_TRACECMDSFX
       
    62 #else
       
    63 #define AKNS_TRACE_INFO(aMsg)
       
    64 #define AKNS_TRACE_INFO1(aFormat,aP1)
       
    65 #define AKNS_TRACE_INFO2(aFormat,aP1,aP2)
       
    66 #define AKNS_TRACE_INFO3(aFormat,aP1,aP2,aP3)
       
    67 #endif
       
    68 
       
    69 #if defined(AKNS_TRACING_ENABLED_NORMAL)
       
    70 #define AKNS_TRACE_DEBUG(aMsg) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX(aMsg) ) AKNS_TRACECMDSFX
       
    71 #define AKNS_TRACE_DEBUG1(aFormat,aP1) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX(aFormat),(aP1) ) AKNS_TRACECMDSFX
       
    72 #define AKNS_TRACE_DEBUG2(aFormat,aP1,aP2) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX(aFormat),(aP1),(aP2) ) AKNS_TRACECMDSFX
       
    73 #define AKNS_TRACE_DEBUG3(aFormat,aP1,aP2,aP3) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX(aFormat),(aP1),(aP2),(aP3) ) AKNS_TRACECMDSFX
       
    74 #else
       
    75 #define AKNS_TRACE_DEBUG(aMsg)
       
    76 #define AKNS_TRACE_DEBUG1(aFormat,aP1)
       
    77 #define AKNS_TRACE_DEBUG2(aFormat,aP1,aP2)
       
    78 #define AKNS_TRACE_DEBUG3(aFormat,aP1,aP2,aP3)
       
    79 #endif
       
    80 
       
    81 #if defined(AKNS_TRACING_ENABLED_ERROR)
       
    82 #define AKNS_TRACE_ADDPREFIX_ERROR(aText) (TPtrC((const TText *)L"AKNSKINS: (Error) \"" L##aText L"\""))
       
    83 #define AKNS_TRACE_ERROR(aMsg) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_ERROR(aMsg) ) AKNS_TRACECMDSFX
       
    84 #define AKNS_TRACE_ERROR1(aFormat,aP1) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_ERROR(aFormat),(aP1) ) AKNS_TRACECMDSFX
       
    85 #define AKNS_TRACE_ERROR2(aFormat,aP1,aP2) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_ERROR(aFormat),(aP1),(aP2) ) AKNS_TRACECMDSFX
       
    86 #define AKNS_TRACE_ERROR3(aFormat,aP1,aP2,aP3) AKNS_TRACECMDPFX ( AKNS_TRACE_ADDPREFIX_ERROR(aFormat),(aP1),(aP2),(aP3) ) AKNS_TRACECMDSFX
       
    87 #define AKNS_TRACE_OBSOLETE(aFunc) AKNS_TRACECMDPFX ( _L("AKNSKINS: (Error) Obsolete function %s used"), _S(aFunc) ) AKNS_TRACECMDSFX
       
    88 #else
       
    89 #define AKNS_TRACE_ERROR(aMsg)
       
    90 #define AKNS_TRACE_ERROR1(aFormat,aP1)
       
    91 #define AKNS_TRACE_ERROR2(aFormat,aP1,aP2)
       
    92 #define AKNS_TRACE_ERROR3(aFormat,aP1,aP2,aP3)
       
    93 #define AKNS_TRACE_OBSOLETE(aFunc)
       
    94 #endif
       
    95 
       
    96 #if defined(_DEBUG)
       
    97 
       
    98 enum TAknsDebugPanicReasons
       
    99     {
       
   100     EAknsDPanicNotInitialized       = -6000,
       
   101     EAknsDPanicInvalidRefCount      = -6001,
       
   102     EAknsDPanicReleaseUnderflow     = -6002,
       
   103     EAknsDPanicInvalidParameter     = -6003,
       
   104     EAknsDPanicIncompatible         = -6004,
       
   105     EAknsDPanicNoWindow             = -6005,
       
   106     EAknsDPanicZeroLayDimension     = -6006,
       
   107     EAknsDPanicBadAlignment         = -6007,
       
   108     EAknsDPanicBadState             = -6008,
       
   109     EAknsDPanicIncorrectUsage       = -6009
       
   110     };
       
   111 
       
   112 #define AKNS_DEBUG_PANIC(aReason) User::Panic(_L("AVKON SKINS"),aReason)
       
   113 
       
   114 #endif
       
   115 
       
   116 //lint -e960 Disable null statement note
       
   117 //lint -esym(755,AKNS_TRACE*) Used in debug only
       
   118 //lint -esym(758,TAknsDebugPanicReasons) Used in debug only
       
   119 //lint -esym(769,TAknsDebugPanicReasons::*) Used in debug only
       
   120 //lint -esym(755,AKNS_DEBUG_PANIC) Used in debug only
       
   121 
       
   122 #endif // AKNSDEBUG_H
       
   123 
       
   124 // End of File