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