inc/cpdebug.h
author kashif.sayed
Fri, 26 Mar 2010 03:06:02 +0530
branchv5backport
changeset 30 f9f9f96b1873
permissions -rw-r--r--
user: kashif.sayed added contentcontrolsrv/.cproject added contentcontrolsrv/.project added contentcontrolsrv/group/ABLD.BAT added contentpublishingsrv/.cproject added contentpublishingsrv/.project added contentpublishingsrv/contentharvester/.cproject added contentpublishingsrv/contentharvester/.project added contentpublishingsrv/contentharvester/contentharvesterclient/group/ABLD.BAT added contentpublishingsrv/contentharvester/contentharvesterserver/group/ABLD.BAT added contentpublishingsrv/contentharvester/contentharvesterswiplugin/group/ABLD.BAT added contentpublishingsrv/contentharvester/factorysettingsplugin/group/ABLD.BAT added contentpublishingsrv/contentharvester/group/ABLD.BAT added contentpublishingsrv/group/ABLD.BAT added dependencies/S3libs/cpswrapper.lib added dependencies/S3libs/hscontentcontrol.lib added dependencies/S3libs/hspswrapper.lib added group/ABLD.BAT added homescreenpluginsrv/group/ABLD.BAT added homescreensrv_plat/group/ABLD.BAT added idlefw/group/ABLD.BAT added inc/ccontentmap.h added inc/cpdebug.h added inc/cpglobals.h added inc/cpliwmap.h added inc/cpluginvalidator.h added inc/cpserverdef.h added inc/cpublisherregistrymap.h added inc/mcssathandler.h added menucontentsrv/group/ABLD.BAT added xcfw/group/ABLD.BAT changed dependencies/S3libs/bld.inf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     1
/*
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     3
* All rights reserved.
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     4
* This component and the accompanying materials are made available
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     6
* which accompanies this distribution, and is available
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     8
*
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
     9
* Initial Contributors:
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    11
*
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    12
* Contributors:
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    13
*
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    14
* Description:  Debug printing to a log file
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    15
 *
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    16
*/
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    17
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    18
#ifndef C_CP_DEBUG_H
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    19
#define C_CP_DEBUG_H
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    20
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    21
// INCLUDES
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    22
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    23
#include <e32base.h>
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    24
#ifdef CONTENT_PUBLISHER_DEBUG
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    25
#include <f32file.h>
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    26
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    27
_LIT(KCPDebugDirName, "contentpublisher" );
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    28
_LIT(KCPDebugFileName, "c:\\contentpublisher.txt" );
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    29
_LIT(KCPDebugFileName2, "c:\\server.txt" );
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    30
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    31
/**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    32
 *  Content publisher debug
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    33
 *
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    34
 *
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    35
 *  @lib cpdebug.lib
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    36
 *  @since  S60 v3.2
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    37
 */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    38
NONSHARABLE_CLASS( CCPDebug ): public CBase
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    39
    {
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    40
public:
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    41
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    42
    IMPORT_C static CCPDebug* NewLC( const TDesC& aFile );
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    43
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    44
    IMPORT_C static CCPDebug* NewL( const TDesC& aFile );
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    45
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    46
    virtual ~CCPDebug();
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    47
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    48
    /**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    49
     * Determines whether CCPDebug is exist .		
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    50
     */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    51
    IMPORT_C static TBool Enable();
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    52
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    53
    /**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    54
     * Enables or disables Printf message logging to a file.		
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    55
     * @param aEnable Set to true to enable logging, false to disable.
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    56
     */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    57
    IMPORT_C static void EnableLogging(TBool aEnable);
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    58
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    59
    /**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    60
     * Print debug text to the file (c:\\contentpublisher.txt). 
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    61
     *
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    62
     */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    63
    IMPORT_C static void Printf(TRefByValue<const TDesC8> aFormat, ...);
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    64
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    65
private:
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    66
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    67
    CCPDebug();
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    68
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    69
    void ConstructL( const TDesC& aFile );
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    70
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    71
    /**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    72
     * Returns a pointer to the thread-local data struct.
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    73
     */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    74
    IMPORT_C static struct DebugData* Data();
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    75
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    76
private: // data
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    77
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    78
    /**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    79
     * Thread local storage for this DLL, as we cannot declare static
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    80
     * global variables in Symbian.
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    81
     */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    82
    struct DebugData* iData;
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    83
    
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    84
    };
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    85
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    86
#define CP_DEBUG(s)    CCPDebug::Printf(s)
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    87
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    88
/**
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    89
 * Thread local storage space. Writable static data is not supported in
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    90
 * Symbian, so static data is stored in this struct.
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    91
 */
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    92
struct DebugData
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    93
    {
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    94
    RFile iLogFile;
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    95
    RFs iFs;
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    96
    TBool iLogEnabled;
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    97
    TTime iFirstUpdateTime;
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    98
    RBuf iFileName;
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
    99
    };
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   100
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   101
#else
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   102
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   103
#define CP_DEBUG(s) 
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   104
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   105
#endif
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   106
f9f9f96b1873 user: kashif.sayed
kashif.sayed
parents:
diff changeset
   107
#endif // C_CP_DEBUG_H