camerauis/cameraxui/cxengine/inc/api/cxutils.h
changeset 48 42ba2d16bf40
parent 19 d9aefe59d544
child 60 a289dde0a1d6
equal deleted inserted replaced
37:64817133cd1d 48:42ba2d16bf40
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    23 #include <QGlobalStatic> // Included to get the ifndef working
    23 #include <QGlobalStatic> // Included to get the ifndef working
    24 #ifndef QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION
    24 #ifndef QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION
    25     #define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION QT_TRAP_THROWING
    25     #define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION QT_TRAP_THROWING
    26 #endif
    26 #endif
    27 
    27 
    28 //! @todo change back when we can use udeb again 
    28 
    29 //#ifdef _DEBUG
    29 // Traces enabled only in debug builds.
    30 #if 1
    30 // These can heavily affect the performance.
       
    31 #ifdef _DEBUG
    31 
    32 
    32     #include <QDebug>       // Qt Debug
    33     #include <QDebug>       // Qt Debug
       
    34 #ifdef Q_OS_SYMBIAN
    33     #include <e32debug.h>   // Symbian Debug
    35     #include <e32debug.h>   // Symbian Debug
       
    36 #endif // Q_OS_SYMBIAN
    34 
    37 
    35     // engine specific debug macros
       
    36     #define CX_DEBUG(msg)                   qDebug msg;
    38     #define CX_DEBUG(msg)                   qDebug msg;
    37     #define CX_DEBUG_SYMBIAN(msg)           RDebug::Print msg;
       
    38     #define CX_DEBUG_ENTER_FUNCTION()       qDebug("%s => ", __PRETTY_FUNCTION__);
    39     #define CX_DEBUG_ENTER_FUNCTION()       qDebug("%s => ", __PRETTY_FUNCTION__);
    39     #define CX_DEBUG_IN_FUNCTION()          qDebug("%s =><= ", __PRETTY_FUNCTION__);
    40     #define CX_DEBUG_IN_FUNCTION()          qDebug("%s =><= ", __PRETTY_FUNCTION__);
    40     #define CX_DEBUG_EXIT_FUNCTION()        qDebug("%s <= ", __PRETTY_FUNCTION__);
    41     #define CX_DEBUG_EXIT_FUNCTION()        qDebug("%s <= ", __PRETTY_FUNCTION__);
       
    42 #ifdef Q_OS_SYMBIAN
       
    43     #define CX_DEBUG_SYMBIAN(msg)           RDebug::Print msg;
    41     #define CX_DEBUG_ASSERT(x)              if( !(x) ) {\
    44     #define CX_DEBUG_ASSERT(x)              if( !(x) ) {\
    42                                                 qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \
    45                                                 qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \
    43                                                 ASSERT(x); \
    46                                                 ASSERT(x); \
    44                                             }
    47                                             }
       
    48 #else // !Q_OS_SYMBIAN
       
    49     #define CX_DEBUG_SYMBIAN(msg)           qDebug()<< msg;
       
    50     #define CX_DEBUG_ASSERT(x)              if( !(x) ) {\
       
    51                                                 qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \
       
    52                                                 Q_ASSERT(x); \
       
    53                                             }
       
    54     #define OstTrace0(x,y,z)
       
    55 
       
    56 #endif // Q_OS_SYMBIAN
    45     #define CX_ASSERT_ALWAYS(x)             CX_DEBUG_ASSERT(x)
    57     #define CX_ASSERT_ALWAYS(x)             CX_DEBUG_ASSERT(x)
    46 
    58 
    47 #else // !_DEBUG
    59 #else // !_DEBUG
    48 
    60 
    49     // engine specific debug macros
       
    50     #define CX_DEBUG(msg)
    61     #define CX_DEBUG(msg)
    51     #define CX_DEBUG_SYMBIAN(msg)
    62     #define CX_DEBUG_SYMBIAN(msg)
    52     #define CX_DEBUG_ENTER_FUNCTION()
    63     #define CX_DEBUG_ENTER_FUNCTION()
    53     #define CX_DEBUG_IN_FUNCTION()
    64     #define CX_DEBUG_IN_FUNCTION()
    54     #define CX_DEBUG_EXIT_FUNCTION()
    65     #define CX_DEBUG_EXIT_FUNCTION()
    55     #define CX_DEBUG_ASSERT(x)
    66     #define CX_DEBUG_ASSERT(x)
       
    67 
       
    68 #ifdef Q_OS_SYMBIAN
    56     #define CX_ASSERT_ALWAYS(x)             ASSERT(x)
    69     #define CX_ASSERT_ALWAYS(x)             ASSERT(x)
       
    70 #else // !Q_OS_SYMBIAN
       
    71     #define CX_ASSERT_ALWAYS(x)             Q_ASSERT(x)
       
    72     #define OstTrace0(x,y,z)    
       
    73 #endif // Q_OS_SYMBIAN
    57 
    74 
    58 #endif // _DEBUG
    75 #endif // _DEBUG
    59 
    76 
    60 
       
    61 
       
    62 #endif // CXUTILS_H
    77 #endif // CXUTILS_H