|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "mcecsreceivequeue.h" |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CMceCsReceiveQueue::CMceCsReceiveQueue |
|
26 // ----------------------------------------------------------------------------- |
|
27 // |
|
28 CMceCsReceiveQueue::CMceCsReceiveQueue () |
|
29 { |
|
30 iReceiveItems.Reset(); |
|
31 } |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CMceCsReceiveQueue::~CMceCsReceiveQueue |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CMceCsReceiveQueue::~CMceCsReceiveQueue () |
|
38 { |
|
39 while (iReceiveItems.Count() > 0) |
|
40 { |
|
41 RemoveFirst(); |
|
42 } |
|
43 iReceiveItems.Close(); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CMceCsReceiveQueue::IsEmpty |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 TBool CMceCsReceiveQueue::IsEmpty () const |
|
51 { |
|
52 return (iReceiveItems.Count() == 0); |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CMceCsReceiveQueue::First |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 TMceCSReceiveItem& CMceCsReceiveQueue::First () |
|
60 { |
|
61 __ASSERT_ALWAYS (iReceiveItems.Count() > 0, |
|
62 User::Panic(KNullDesC, KErrGeneral)); |
|
63 return iReceiveItems[0]; |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CMceCsReceiveQueue::AddLast |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TInt CMceCsReceiveQueue::AddLast (const TMceCSReceiveItem& aItem) |
|
71 { |
|
72 return iReceiveItems.Append(aItem); |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CMceCsReceiveQueue::RemoveFirst |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void CMceCsReceiveQueue::RemoveFirst () |
|
80 { |
|
81 if (iReceiveItems.Count() > 0) |
|
82 { |
|
83 TMceCSReceiveItem& item = iReceiveItems[0]; |
|
84 delete item.Context(); |
|
85 delete item.Content(); |
|
86 iReceiveItems.Remove(0); |
|
87 } |
|
88 } |
|
89 |