0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2009 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 |
|
|
18 |
|
|
19 |
|
|
20 |
#include <e32std.h>
|
|
21 |
|
|
22 |
#define ASSERT_BUFFER 256
|
|
23 |
|
|
24 |
/********************************************************************************
|
|
25 |
*
|
|
26 |
* Assert_StripPath
|
|
27 |
*
|
|
28 |
* Remove the drive and folders from a full path and leave only
|
|
29 |
* the filename.
|
|
30 |
********************************************************************************/
|
|
31 |
void Assert_StripPath( TDes8 & file )
|
|
32 |
{
|
|
33 |
static const TUint8 backSlash = '\\';
|
|
34 |
TInt index = 0;
|
|
35 |
if(KErrNotFound != (index = file.LocateReverse(backSlash)))
|
|
36 |
{
|
|
37 |
TBuf8<ASSERT_BUFFER> temp = file.Right(file.Length() - (index + 1));
|
|
38 |
file = temp;
|
|
39 |
}
|
|
40 |
}
|
|
41 |
|
|
42 |
/********************************************************************************
|
|
43 |
*
|
|
44 |
* AssertE
|
|
45 |
*
|
|
46 |
********************************************************************************/
|
|
47 |
void AssertE( TPtrC8 _file, TInt _line )
|
|
48 |
{
|
|
49 |
TBuf8<ASSERT_BUFFER> buffer8;
|
|
50 |
TBuf8<256> file( _file );
|
|
51 |
Assert_StripPath( file );
|
|
52 |
buffer8.Format( (TPtrC8(reinterpret_cast<const TText8*>("!%S"))), &(file) );
|
|
53 |
|
|
54 |
#if defined (_UNICODE)
|
|
55 |
TBuf16<ASSERT_BUFFER> buffer16;
|
|
56 |
buffer16.Copy(buffer8);
|
|
57 |
User::Panic(buffer16, _line);
|
|
58 |
#else // defined(_UNICODE)
|
|
59 |
User::Panic(buffer8, _line);
|
|
60 |
#endif //defined(_UNICODE)
|
|
61 |
}
|
|
62 |
|