camerauis/cameraxui/cxengine/inc/api/cxutils.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2009-2010 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:
       
    15 *
       
    16 */
       
    17 #ifndef CXUTILS_H
       
    18 #define CXUTILS_H
       
    19 
       
    20 // This macro changed name between Qt 4.5.2 and Qt 4.6.0.
       
    21 // Make the old name available, if not defined.
       
    22 //! @todo Remove once old environments not used anymore.
       
    23 #include <QGlobalStatic> // Included to get the ifndef working
       
    24 #ifndef QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION
       
    25     #define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION QT_TRAP_THROWING
       
    26 #endif
       
    27 
       
    28 
       
    29 // Traces enabled only in debug builds.
       
    30 // These can heavily affect the performance.
       
    31 #ifdef _DEBUG
       
    32 
       
    33     #include <QDebug>       // Qt Debug
       
    34 #ifdef Q_OS_SYMBIAN
       
    35     #include <e32debug.h>   // Symbian Debug
       
    36 #endif // Q_OS_SYMBIAN
       
    37 
       
    38     #define CX_DEBUG(msg)                   qDebug msg;
       
    39     #define CX_DEBUG_ENTER_FUNCTION()       qDebug("%s => ", __PRETTY_FUNCTION__);
       
    40     #define CX_DEBUG_IN_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;
       
    44     #define CX_DEBUG_ASSERT(x)              if( !(x) ) {\
       
    45                                                 qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \
       
    46                                                 ASSERT(x); \
       
    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
       
    57     #define CX_ASSERT_ALWAYS(x)             CX_DEBUG_ASSERT(x)
       
    58 
       
    59 #else // !_DEBUG
       
    60 
       
    61     #define CX_DEBUG(msg)
       
    62     #define CX_DEBUG_SYMBIAN(msg)
       
    63     #define CX_DEBUG_ENTER_FUNCTION()
       
    64     #define CX_DEBUG_IN_FUNCTION()
       
    65     #define CX_DEBUG_EXIT_FUNCTION()
       
    66     #define CX_DEBUG_ASSERT(x)
       
    67 
       
    68 #ifdef Q_OS_SYMBIAN
       
    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
       
    74 
       
    75 #endif // _DEBUG
       
    76 
       
    77 #endif // CXUTILS_H