--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookengines/VirtualPhonebook/VPbkLdapStore/src/TContactFieldData.cpp Tue Feb 02 10:12:17 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact field data class implementation
+*
+*/
+
+
+// INCLUDES
+#include "tcontactfielddata.h"
+#include "ldapcontactfield.h"
+
+// -----------------------------------------------------------------------------
+// LDAP Store namespace
+// -----------------------------------------------------------------------------
+namespace LDAPStore {
+
+// -----------------------------------------------------------------------------
+// TContactFieldData::TContactFieldData
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+TContactFieldData::TContactFieldData() : iField(NULL)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TContactFieldData::~TContactFieldData
+// TContactFieldData Destructor
+// -----------------------------------------------------------------------------
+//
+TContactFieldData::~TContactFieldData()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// TContactFieldData public methods
+// -----------------------------------------------------------------------------
+// TContactFieldData::SetField
+// Set field
+// -----------------------------------------------------------------------------
+//
+void TContactFieldData::SetField(CLDAPContactField& aField)
+ {
+ iField = &aField;
+ }
+
+// -----------------------------------------------------------------------------
+// MVPbkContactFieldData implementation
+// -----------------------------------------------------------------------------
+// TContactFieldData::IsEmpty
+// Returns true if data is empty
+// -----------------------------------------------------------------------------
+//
+TBool TContactFieldData::IsEmpty() const
+ {
+ return (iField) ? iField->Data().Length() == 0 : ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// TContactFieldData::CopyL
+// Copies data from given field data.
+// -----------------------------------------------------------------------------
+//
+void TContactFieldData::CopyL(const MVPbkContactFieldData& aFieldData)
+ {
+ if (aFieldData.DataType() == DataType())
+ {
+ SetTextL(MVPbkContactFieldTextData::Cast(aFieldData).Text());
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// MVPbkContactFieldTextData implementation
+// -----------------------------------------------------------------------------
+// TContactFieldData::Text
+// Returns the string data.
+// -----------------------------------------------------------------------------
+//
+TPtrC TContactFieldData::Text() const
+ {
+ return (iField) ? iField->Data() : TPtrC();
+ }
+
+// -----------------------------------------------------------------------------
+// TContactFieldData::SetTextL
+// Sets the string data.
+// -----------------------------------------------------------------------------
+//
+void TContactFieldData::SetTextL(const TDesC& aText)
+ {
+ if (iField)
+ {
+ iField->SetDataL(aText);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TContactFieldData::MaxLength
+// Returns maximum length of the field.
+// -----------------------------------------------------------------------------
+//
+TInt TContactFieldData::MaxLength() const
+ {
+ return KVPbkUnlimitedFieldLength;
+ }
+
+} // End of namespace LDAPStore
+