|
1 /* |
|
2 * Copyright (c) 2005 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: Collection of utility functions used by Postcard class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef POSTCARDUTILS_H |
|
21 #define POSTCARDUTILS_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CContactItemFieldSet; |
|
27 class CContactItemField; |
|
28 class CContactCard; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Collection of static utility functions used by Postcard classes |
|
34 * |
|
35 * @lib postcard.exe |
|
36 * @since 3.0 |
|
37 */ |
|
38 class TPostcardUtils |
|
39 { |
|
40 public: // Constants |
|
41 enum |
|
42 { |
|
43 // There are 8 different tags (%0U...%7U) that may be embedded into |
|
44 // special format string. 6 address fields + name + greeting. |
|
45 ENumSpecFormatTags = 8 |
|
46 }; |
|
47 |
|
48 public: // Methods |
|
49 |
|
50 /** |
|
51 * Returns the label of the field aId. |
|
52 * This is used innerly in Postcard application to |
|
53 * distinguish fields from each other in CContactItem object. |
|
54 */ |
|
55 static const TPtrC ContactItemNameFromId( TInt aId ); |
|
56 |
|
57 /** |
|
58 * Returns the id of the label aLabel. |
|
59 * This is used innerly in Postcard application to |
|
60 * distinguish fields from each other in CContactItem oject. |
|
61 */ |
|
62 static TInt IdFromContactItemName( const TDesC& aLabel ); |
|
63 |
|
64 /** |
|
65 * Converts a label to a contact item field |
|
66 */ |
|
67 static const CContactItemField* FieldOrNull( |
|
68 const CContactItemFieldSet& aSet, const TDesC& aLabel ); |
|
69 /** |
|
70 * Adds a field to a contact |
|
71 */ |
|
72 static void AddContactFieldL( CContactCard& aCard, const TDesC& aLabel, |
|
73 const TDesC& aFieldText ); |
|
74 /** |
|
75 * Converts special format string tag to contact item name |
|
76 */ |
|
77 static const TPtrC ContactItemNameFromTag( TInt aTag ); |
|
78 /** |
|
79 * Finds next special format tag from a string |
|
80 */ |
|
81 static TInt NextTag(const TDesC& aFormat, TInt& aTag); |
|
82 }; |
|
83 |
|
84 #endif // POSTCARDUTILS_H |
|
85 |
|
86 // End of file |