Update contrib.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #include "t_wservconfigdata.h"
25 // Construction/Destruction
28 CT_WServConfigData::CT_WServConfigData()
32 CT_WServConfigData::~CT_WServConfigData()
37 void CT_WServConfigData::ReplaceData(const TDesC& aName, const TDesC& aData)
39 TInt count=iArrayName.Count();
41 for ( index=0; index<count; ++index )
43 if ( aName.Compare(iArrayName[index]) == 0 )
49 iArrayData.Remove(index);
50 iArrayData.Insert(aData,index);
53 void CT_WServConfigData::AddDataL(const TDesC& aName, const TDesC& aData)
55 // Ensure name does not already exist
56 TInt count=iArrayName.Count();
58 for ( index=0; index<count; ++index )
60 if ( aName.Compare(iArrayName[index]) == 0 )
62 User::Leave(KErrAlreadyExists);
66 iArrayName.AppendL(aName);
67 iArrayData.AppendL(aData);
70 void CT_WServConfigData::DeleteDataL(const TDesC& aName)
72 // Ensure name already exist
74 TInt count=iArrayName.Count();
75 for ( TInt index=0; (index<count) && (!found); ++index )
77 if ( aName.Compare(iArrayName[index]) == 0 )
80 iArrayName.Remove(index);
81 iArrayData.Remove(index);
87 User::Leave(KErrNotFound);
92 const TWServConfigData& CT_WServConfigData::GetData(const TInt aIndex) const
94 return iArrayData[aIndex];
97 const TWServConfigData& CT_WServConfigData::GetName(const TInt aIndex) const
99 return iArrayName[aIndex];
102 void CT_WServConfigData::Empty()
108 TInt CT_WServConfigData::NoOfEntriesL() const
110 TInt dataCount=iArrayData.Count();
111 TInt nameCount=iArrayName.Count();
113 if (dataCount!=nameCount)
115 User::Leave(KErrGeneral);