|
1 // Copyright (c) 2003-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef _EMS_UTILS_H |
|
23 #define _EMS_UTILS_H |
|
24 |
|
25 #include <e32std.h> |
|
26 #include "Gsmuelem.h" |
|
27 |
|
28 // forward declarations |
|
29 class CSmsMessage; |
|
30 class CEmsInformationElement; |
|
31 class CEmsPictureIE; |
|
32 class CEmsAnimationIE; |
|
33 class CFbsBitmap; |
|
34 |
|
35 namespace EmsTestUtils |
|
36 { |
|
37 |
|
38 // function to compare two EMS information elements. |
|
39 IMPORT_C TBool CompareEmsIE(const CEmsInformationElement& aLeft, const CEmsInformationElement& aRight); |
|
40 |
|
41 // function to compare two SMS messages with EMS objects |
|
42 IMPORT_C TBool CompareEmsMsgL(const CSmsMessage& aLeft, const CSmsMessage& aRight); |
|
43 |
|
44 // function to find EMS element with given ID |
|
45 IMPORT_C const CEmsInformationElement* FindElementL(const CSmsMessage& aMsg, CSmsInformationElement::TSmsInformationElementIdentifier aId); |
|
46 |
|
47 // Creates an EmsPicture object from the \ems\pics.mbm file. The |
|
48 // index into the MBM file is passed (0 is small, 1 is large, |
|
49 // 2 is variable) |
|
50 IMPORT_C CEmsPictureIE* CreatePictureL(TInt aIndex); |
|
51 |
|
52 // Creates an EmsAnimationIE object from the \ems\anims.mbm file. The |
|
53 // index into the MBM file is passed (0 is small, 1 is large) |
|
54 IMPORT_C CEmsAnimationIE* CreateAnimationL(TInt aIndex); |
|
55 |
|
56 // Returns an array of adjusted EMS objects. These ems objects must be |
|
57 // destroyed when the array is destroyed. The adjusted array |
|
58 // fixes up formatting to remerge concatenated messages |
|
59 void AdjustedEmsObjectsL(const CSmsMessage& aMsg, RPointerArray<CEmsInformationElement>& aMdjusted); |
|
60 |
|
61 // function to extract the text portion of an SMS message into |
|
62 // an HBufC. This newly created HBufC is put onto the cleanup stack |
|
63 HBufC* ExtractSmsTextLC(const CSmsMessage& aMsg); |
|
64 |
|
65 // Creates an object from loaded bitmap - used by CreatePictureLC and |
|
66 // CreateAnimationLC. T is an object type which can be constructed |
|
67 // from a bitmap. filename is the file to load the bitmap from |
|
68 // (assumed to be in C: or Z:) and index is the index into the bitmap |
|
69 template <class T> |
|
70 T* CreateEmsObjFromBitmapL(const TDesC& aFilename, TInt32 aIndex); |
|
71 } |
|
72 |
|
73 // This class is really only used in CompareEmsMsg. It enhances RPointerArray |
|
74 // such that on close, all the elements in the array will be |
|
75 // destroyed. This is required for proper handling in the CleanupStack |
|
76 class RSafeEmsArray : public RPointerArray<CEmsInformationElement> |
|
77 { |
|
78 public: |
|
79 RSafeEmsArray() : RPointerArray<CEmsInformationElement>(10) {} |
|
80 ~RSafeEmsArray() { Close(); } |
|
81 void Close() |
|
82 { |
|
83 ResetAndDestroy(); |
|
84 RPointerArray<CEmsInformationElement>::Close(); |
|
85 } |
|
86 }; |
|
87 |
|
88 |
|
89 #endif |