|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Implementation of the ScanListIterator class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "hssscanlist.h" |
|
21 #include "hssscanlistiterator.h" |
|
22 |
|
23 // ================= MEMBER FUNCTIONS ======================= |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 HssScanListIterator::HssScanListIterator( const HssScanList& scan_list ) |
|
30 :current_m( &scan_list.data_m[0] ), |
|
31 scan_list_m( scan_list ) |
|
32 { |
|
33 } |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 const HssScanFrame* HssScanListIterator::First() |
|
40 { |
|
41 if ( scan_list_m.size_m == 0 ) |
|
42 { |
|
43 // No data stored -> no first elemen -> set NULL. |
|
44 return NULL; |
|
45 } |
|
46 // Data exist -> set current at the beginning od the data. |
|
47 current_m = &scan_list_m.data_m[0]; |
|
48 return current_m; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 const HssScanFrame* HssScanListIterator::Next() |
|
56 { |
|
57 current_m += HssScanList::AddPadding( Size() ); |
|
58 return Current(); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 const HssScanFrame* HssScanListIterator::Current() const |
|
66 { |
|
67 if( current_m >= scan_list_m.data_m + scan_list_m.size_m ) |
|
68 { |
|
69 return NULL; |
|
70 } |
|
71 |
|
72 return current_m; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 TBool HssScanListIterator::IsDone() const |
|
80 { |
|
81 return ( current_m >= scan_list_m.data_m + scan_list_m.size_m ); |
|
82 } |