sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// General inline utility and logging functions for use with DirectGDI.
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
@publishedPartner
|
sl@0
|
21 |
@prototype
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
#ifndef DIRECTGDIPANICS_INL
|
sl@0
|
25 |
#define DIRECTGDIPANICS_INL
|
sl@0
|
26 |
|
sl@0
|
27 |
#include <e32std.h>
|
sl@0
|
28 |
#include <e32debug.h>
|
sl@0
|
29 |
|
sl@0
|
30 |
_LIT(KDGDILogFormat, "File %S +%i: %S");
|
sl@0
|
31 |
_LIT(KDGDINonConditionalPanicFormat, "Panic: %S %i.");
|
sl@0
|
32 |
_LIT(KDGDIConditionalPanicFormat, "Panic: %S %i, assert \"%S\" failed.");
|
sl@0
|
33 |
|
sl@0
|
34 |
namespace DirectGdi
|
sl@0
|
35 |
{
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
Helper function used by the GRAPHICS_LOG_ALWAYS and GRAPHICS_LOGD_ALWAYS macros.
|
sl@0
|
39 |
*/
|
sl@0
|
40 |
inline void Log(const TDesC& aFileName, TInt aLine, const TDesC& aLogMessage)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
TBuf<256> buf;
|
sl@0
|
43 |
buf.Format(KDGDILogFormat, &aFileName, aLine, &aLogMessage);
|
sl@0
|
44 |
RDebug::Print(buf);
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
/**
|
sl@0
|
48 |
Helper function used by GRAPHICS_ASSERT_ALWAYS and GRAPHICS_PANIC_ALWAYS macros
|
sl@0
|
49 |
which allows a panic category and code to be logged.
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
inline void PanicWithDebugLog (
|
sl@0
|
52 |
const TDesC& aPanicCategory,
|
sl@0
|
53 |
TInt aPanicCode,
|
sl@0
|
54 |
const TDesC& aFileName,
|
sl@0
|
55 |
TInt aLine,
|
sl@0
|
56 |
const TDesC* aCondition)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
TBuf<256> message;
|
sl@0
|
59 |
|
sl@0
|
60 |
if (aCondition)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
message.Format(KDGDIConditionalPanicFormat, &aPanicCategory, aPanicCode, aCondition);
|
sl@0
|
63 |
}
|
sl@0
|
64 |
else
|
sl@0
|
65 |
{
|
sl@0
|
66 |
message.Format(KDGDINonConditionalPanicFormat, &aPanicCategory, aPanicCode);
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
Log(aFileName, aLine, message);
|
sl@0
|
70 |
|
sl@0
|
71 |
User::Panic(aPanicCategory, aPanicCode);
|
sl@0
|
72 |
}
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
#endif // DIRECTGDIPANICS_INL
|
sl@0
|
76 |
|
sl@0
|
77 |
|