|
1 /* |
|
2 * Copyright (c) 2010 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: Email Client API definitions |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __EMAILAPIDEFS |
|
19 #define __EMAILAPIDEFS |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <f32file.h> |
|
23 |
|
24 namespace EmailInterface { |
|
25 |
|
26 /** |
|
27 * Id for message, message part, folder and mailbox entries |
|
28 */ |
|
29 typedef TUint TEntryId; |
|
30 |
|
31 /** |
|
32 * Interface id. Each implementation of MEmailInterface has unique id value. |
|
33 */ |
|
34 typedef TInt TEmailTypeId; |
|
35 |
|
36 const TEntryId KUndefinedEntryId = 0; |
|
37 |
|
38 /** |
|
39 * base interface for all email interfaces available to clients |
|
40 * @since S60 v5.0 |
|
41 */ |
|
42 class MEmailInterface |
|
43 { |
|
44 public: |
|
45 /** returns interface id (kind of RTTI) */ |
|
46 virtual TEmailTypeId InterfaceId() const = 0; |
|
47 |
|
48 /** frees memory allocated by interface impl. */ |
|
49 virtual void Release() = 0; |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Defines abstraction for entry ID. Used by message, folder, mailbox etc types. |
|
54 * @since S60 v5.0 |
|
55 */ |
|
56 class TBaseId |
|
57 { |
|
58 public: |
|
59 inline TBaseId() : iId( KUndefinedEntryId ){} |
|
60 inline TBaseId( TEntryId aId ) : iId( aId ){} |
|
61 |
|
62 TEntryId iId; |
|
63 }; |
|
64 |
|
65 /** |
|
66 * Defines mailbox ID |
|
67 * @since S60 v5.0 |
|
68 */ |
|
69 class TMailboxId : public TBaseId |
|
70 { |
|
71 public: |
|
72 inline TMailboxId() : |
|
73 TBaseId(){} |
|
74 inline TMailboxId( TEntryId aId ) : TBaseId( aId ){} |
|
75 inline TBool operator==( const TMailboxId& aMailboxId ) const { |
|
76 return ( aMailboxId.iId == iId ); } |
|
77 }; |
|
78 |
|
79 /** |
|
80 * Defines folder ID which is associated with a mailbox |
|
81 * @since S60 v5.0 |
|
82 */ |
|
83 class TFolderId : public TBaseId |
|
84 { |
|
85 public: |
|
86 // parent mailbox |
|
87 TMailboxId iMailboxId; |
|
88 inline TFolderId( TEntryId aId, const TMailboxId& aMailboxId ) : |
|
89 TBaseId( aId ),iMailboxId( aMailboxId.iId ){} |
|
90 |
|
91 inline TFolderId() : TBaseId(), iMailboxId() {} |
|
92 |
|
93 inline TBool operator==( const TFolderId& aFolderId ) const { |
|
94 return ( iMailboxId.iId == aFolderId.iMailboxId.iId && |
|
95 iId == aFolderId.iId ); } |
|
96 |
|
97 inline TBool operator!=( const TFolderId& aFolderId ) const { |
|
98 return !( aFolderId == *this ); } |
|
99 }; |
|
100 |
|
101 /** |
|
102 * Defines email message ID which is associated with a mailbox and folder |
|
103 * @since S60 v5.0 |
|
104 */ |
|
105 class TMessageId : public TBaseId |
|
106 { |
|
107 public: |
|
108 inline TMessageId() : TBaseId(), iFolderId(){} |
|
109 |
|
110 inline TMessageId( TEntryId aMsgId, TEntryId aFolderId, TMailboxId aMailboxId ) : |
|
111 TBaseId( aMsgId ), iFolderId( aFolderId, aMailboxId ){} |
|
112 |
|
113 inline TBool operator==( const TMessageId& aMessageId ) const { |
|
114 return ( iFolderId == aMessageId.iFolderId && |
|
115 iId == aMessageId.iId ); } |
|
116 |
|
117 inline TBool operator!=( const TMessageId& aMessageId ) const { |
|
118 return !( aMessageId == *this ); } |
|
119 |
|
120 /** |
|
121 * parent folder id. |
|
122 */ |
|
123 TFolderId iFolderId; |
|
124 }; |
|
125 |
|
126 |
|
127 /** |
|
128 * Message content (part) id |
|
129 * @since S60 v5.0 |
|
130 */ |
|
131 class TMessageContentId : public TBaseId |
|
132 { |
|
133 public: |
|
134 inline TMessageContentId(): TBaseId(), iMessageId() {} |
|
135 |
|
136 inline TMessageContentId( TEntryId aContentId, TEntryId aMsgId, TEntryId aFolderId, TMailboxId aMailboxId ) : |
|
137 TBaseId( aContentId ), iMessageId( aMsgId, aFolderId, aMailboxId ){} |
|
138 |
|
139 inline TBool operator==( const TMessageContentId& aContentId ) const { |
|
140 return ( iMessageId == aContentId.iMessageId && |
|
141 iId == aContentId.iId ); } |
|
142 |
|
143 inline TBool operator!=( const TMessageContentId& aContentId ) const { |
|
144 return !( aContentId == *this ); } |
|
145 |
|
146 // parent message |
|
147 TMessageId iMessageId; |
|
148 }; |
|
149 |
|
150 typedef RArray<TMessageId> REmailMessageIdArray; |
|
151 |
|
152 typedef RArray<TFolderId> REmailFolderIdArray; |
|
153 |
|
154 typedef RArray<TMailboxId> REmailMailboxIdArray; |
|
155 |
|
156 } // EmailInterface |
|
157 |
|
158 #endif // __EMAILAPIDEFS |