|
1 /* |
|
2 * Copyright (c) 2002 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 * BCard export property. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CBCardExportProperty.h" |
|
22 #include <barsread.h> |
|
23 #include <CPbkFieldInfo.h> |
|
24 #include <CPbkFieldsInfo.h> |
|
25 |
|
26 // ==================== MEMBER FUNCTIONS ==================== |
|
27 |
|
28 inline CBCardExportProperty::CBCardExportProperty() |
|
29 { |
|
30 } |
|
31 |
|
32 inline void CBCardExportProperty::ConstructL( |
|
33 TResourceReader& aReader, const CPbkFieldsInfo& aFieldsInfo) |
|
34 { |
|
35 HBufC* name16 = aReader.ReadHBufCL(); |
|
36 CleanupStack::PushL(name16); |
|
37 HBufC8* name = HBufC8::NewLC(name16->Length()); |
|
38 TPtr8 namePtr = name->Des(); |
|
39 namePtr.Copy(*name16); |
|
40 iName = name; |
|
41 CleanupStack::Pop(name); |
|
42 CleanupStack::PopAndDestroy(name16); |
|
43 |
|
44 iStorageType = TPbkVersitStorageType(aReader.ReadInt8()); |
|
45 |
|
46 TInt count=aReader.ReadInt16(); |
|
47 while (count-- > 0) |
|
48 { |
|
49 const TPbkFieldId fieldId = TPbkFieldId(aReader.ReadInt8()); |
|
50 const TPbkFieldLocation location = TPbkFieldLocation(aReader.ReadInt8()); |
|
51 |
|
52 CPbkFieldInfo* info = aFieldsInfo.Find(fieldId, location); |
|
53 if (info) |
|
54 { |
|
55 User::LeaveIfError(iFieldInfos.Append(info)); |
|
56 } |
|
57 } |
|
58 } |
|
59 |
|
60 CBCardExportProperty* CBCardExportProperty::NewLC( |
|
61 TResourceReader& aReader, const CPbkFieldsInfo& aFieldsInfo) |
|
62 { |
|
63 CBCardExportProperty* self = new(ELeave) CBCardExportProperty; |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(aReader, aFieldsInfo); |
|
66 return self; |
|
67 } |
|
68 |
|
69 CBCardExportProperty::~CBCardExportProperty() |
|
70 { |
|
71 delete iName; |
|
72 iFieldInfos.Close(); |
|
73 } |
|
74 |
|
75 const TDesC8& CBCardExportProperty::Name() const |
|
76 { |
|
77 return *iName; |
|
78 } |
|
79 |
|
80 TPbkVersitStorageType CBCardExportProperty::StorageType() const |
|
81 { |
|
82 return iStorageType; |
|
83 } |
|
84 |
|
85 TInt CBCardExportProperty::InfoCount() const |
|
86 { |
|
87 return iFieldInfos.Count(); |
|
88 } |
|
89 |
|
90 const CPbkFieldInfo* CBCardExportProperty::InfoAt(TInt aIndex) const |
|
91 { |
|
92 return iFieldInfos[aIndex]; |
|
93 } |
|
94 |
|
95 // End of File |