Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include "D32Assert.h"
20 #if defined(_ASSERTIONS) || defined(_NOTIFY) || defined(_TRACE)
21 TPtrC Util::Filename(const TText* aFile)
24 TInt ix=p.LocateReverse('\\'); // MSVC uses \ as path separator, GCC uses /
26 ix=p.LocateReverse('/');
31 #endif//defined(_ASSERTIONS) || defined(_NOTIFY) || defined(_TRACE)
33 #if defined(_ASSERTIONS)
34 void Util::Assert(const TText* aFile,TInt aLine)
36 TBuf<32> b=_S("dbms:");
40 #endif//defined(_ASSERTIONS)
43 #pragma message(__FILE__ " : Leave Notification is enabled")
45 void Util::Leave(const TText* aFile,TInt aLine,TInt aError)
47 TPtrC f(Filename(aFile));
49 _LIT(KFormat,"***Error=%d at %S(%d)");
50 buf.Format(KFormat,aError,&f,aLine);
52 _LIT(KNotify,"DBMS Leave ");
53 buf.Insert(0,KNotify);
54 // User::InfoPrint(buf);
59 TInt Util::LeaveIfError(const TText* aFile,TInt aLine,TInt aError)
62 Leave(aFile,aLine,aError);
65 #endif//defined(_NOTIFY)
68 #pragma message(__FILE__ " : Tracing is enabled")
70 void Util::Trace(const TText* aFile,TInt aLine)
72 TPtrC f(Filename(aFile));
73 _LIT(KFormat,"%S(%d)\n");
74 RDebug::Print(KFormat,&f,aLine);
77 void Util::Trace(const TText* aFile,TInt aLine,const TText* aString)
79 TPtrC f(Filename(aFile));
80 _LIT(KFormat,"%S(%d) : %s\n");
81 RDebug::Print(KFormat,&f,aLine,aString);
83 void Util::Trace(const TText* aFile,TInt aLine,const TText* aExp,const TDesC& aDes)
85 TPtrC f(Filename(aFile));
86 _LIT(KFormat,"%S(%d) : %s = \"%S\"\n");
87 RDebug::Print(KFormat,&f,aLine,aExp,&aDes);
90 void Util::Trace(const TText* aFile,TInt aLine,const TText* aExp,const TAny* aPtr)
92 TPtrC f(Filename(aFile));
93 _LIT(KFormat,"%S(%d) : %s = %08x\n");
94 RDebug::Print(KFormat,&f,aLine,aExp,TUint(aPtr));
97 void Util::Trace(const TText* aFile,TInt aLine,const TText* aExp,TInt aVal)
99 TPtrC f(Filename(aFile));
100 _LIT(KFormat,"%S(%d) : %s = %d (0x%x)\n");
101 RDebug::Print(KFormat,&f,aLine,aExp,aVal,aVal);
103 #endif//defined(_TRACE)
105 #ifdef __DBINVARIANT__
106 void Util::Invariant(TBool aExprVal)
113 #endif//__DBINVARIANT__