|
1 /* |
|
2 * Copyright (c) 2005-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: Contact field data class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "tcontactfielddata.h" |
|
21 #include "ldapcontactfield.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // LDAP Store namespace |
|
25 // ----------------------------------------------------------------------------- |
|
26 namespace LDAPStore { |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // TContactFieldData::TContactFieldData |
|
30 // C++ default constructor can NOT contain any code, that might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TContactFieldData::TContactFieldData() : iField(NULL) |
|
34 { |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // TContactFieldData::~TContactFieldData |
|
39 // TContactFieldData Destructor |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 TContactFieldData::~TContactFieldData() |
|
43 { |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // TContactFieldData public methods |
|
48 // ----------------------------------------------------------------------------- |
|
49 // TContactFieldData::SetField |
|
50 // Set field |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 void TContactFieldData::SetField(CLDAPContactField& aField) |
|
54 { |
|
55 iField = &aField; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // MVPbkContactFieldData implementation |
|
60 // ----------------------------------------------------------------------------- |
|
61 // TContactFieldData::IsEmpty |
|
62 // Returns true if data is empty |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 TBool TContactFieldData::IsEmpty() const |
|
66 { |
|
67 return (iField) ? iField->Data().Length() == 0 : ETrue; |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // TContactFieldData::CopyL |
|
72 // Copies data from given field data. |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void TContactFieldData::CopyL(const MVPbkContactFieldData& aFieldData) |
|
76 { |
|
77 if (aFieldData.DataType() == DataType()) |
|
78 { |
|
79 SetTextL(MVPbkContactFieldTextData::Cast(aFieldData).Text()); |
|
80 } |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // MVPbkContactFieldTextData implementation |
|
85 // ----------------------------------------------------------------------------- |
|
86 // TContactFieldData::Text |
|
87 // Returns the string data. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TPtrC TContactFieldData::Text() const |
|
91 { |
|
92 return (iField) ? iField->Data() : TPtrC(); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // TContactFieldData::SetTextL |
|
97 // Sets the string data. |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void TContactFieldData::SetTextL(const TDesC& aText) |
|
101 { |
|
102 if (iField) |
|
103 { |
|
104 iField->SetDataL(aText); |
|
105 } |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // TContactFieldData::MaxLength |
|
110 // Returns maximum length of the field. |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 TInt TContactFieldData::MaxLength() const |
|
114 { |
|
115 return KVPbkUnlimitedFieldLength; |
|
116 } |
|
117 |
|
118 } // End of namespace LDAPStore |
|
119 |