|
1 // Copyright (c) 2004-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 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #include <elements/metaiterator.h> |
|
22 #include <elements/metadata.h> |
|
23 #include <elements/metatype.h> |
|
24 |
|
25 |
|
26 using namespace Meta; |
|
27 |
|
28 EXPORT_C TMetaVTableIterator::TMetaVTableIterator(MMetaData const* aMetaData) : |
|
29 iEntry(aMetaData->GetVDataTable() + 1) |
|
30 /** |
|
31 * Constructor |
|
32 */ |
|
33 { |
|
34 } |
|
35 |
|
36 EXPORT_C TMetaVTableIterator::~TMetaVTableIterator() |
|
37 /** |
|
38 * Destructor |
|
39 */ |
|
40 { |
|
41 } |
|
42 |
|
43 TBool TMetaVTableIterator::IsNextEntryPresent() |
|
44 /** |
|
45 * Recursive helper function. |
|
46 * Protected and not exported to be used only by TMetaVTableIterator objects. |
|
47 * Recursively traverses Virtual Data Tables in the derivation chain until |
|
48 * the next entry or the end of the last table has been reached, updating |
|
49 * TMetaVTableIterator's internal state (iEntry) at each step of the way. |
|
50 * Returns ETrue if there is another entry present or EFalse if there is not. |
|
51 */ |
|
52 { |
|
53 //are we at the end of a table? |
|
54 if (iEntry->iOffset == 0) |
|
55 {//this is the last table |
|
56 return EFalse; //no more entries present |
|
57 } |
|
58 if (iEntry->iMetaNewL == NULL) |
|
59 {//the end of the table, go for the superclass table |
|
60 typedef SVDataTableEntry* (*TMetaBaseTableNewL)(); |
|
61 iEntry = reinterpret_cast<TMetaBaseTableNewL>(iEntry->iOffset)(); |
|
62 iEntry++; //skip the first entry of the base class table containing TypeId |
|
63 return IsNextEntryPresent(); |
|
64 } |
|
65 return ETrue; //next entry (possibly in the base class) is present |
|
66 } |
|
67 |
|
68 EXPORT_C SVDataTableEntry const* TMetaVTableIterator::operator++(TInt /*aDummy*/) |
|
69 /** |
|
70 * Postfix increment operator. |
|
71 * Walks through virtual data tables each time returning an entry. |
|
72 * When the end of the last lable is reached returns NULL. |
|
73 */ |
|
74 { |
|
75 if (!IsNextEntryPresent()) |
|
76 return NULL; |
|
77 |
|
78 SVDataTableEntry const* entry = iEntry; |
|
79 iEntry++; |
|
80 return entry; |
|
81 } |
|
82 |
|
83 |