|
1 /* |
|
2 * Copyright (c) 2009 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: s_spentry.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <spentry.h> |
|
19 #include <spproperty.h> |
|
20 |
|
21 |
|
22 CSPEntry* CSPEntry::NewL() |
|
23 { |
|
24 CSPEntry* self = CSPEntry::NewLC(); |
|
25 CleanupStack::Pop(self); |
|
26 return self; |
|
27 } |
|
28 |
|
29 CSPEntry* CSPEntry::NewLC() |
|
30 { |
|
31 CSPEntry* self = new ( ELeave) CSPEntry; |
|
32 CleanupStack::PushL( self ); |
|
33 self->ConstructL(); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CSPEntry::~CSPEntry() |
|
38 { |
|
39 iServiceName.Close(); |
|
40 iPropertyArray.ResetAndDestroy(); |
|
41 iPropertyArray.Close(); |
|
42 } |
|
43 |
|
44 TServiceId CSPEntry::GetServiceId() const |
|
45 { |
|
46 return iServiceId; |
|
47 } |
|
48 |
|
49 void CSPEntry::SetServiceId( TServiceId aServiceId ) |
|
50 { |
|
51 iServiceId = aServiceId; |
|
52 } |
|
53 |
|
54 const TDesC16& CSPEntry::GetServiceName() const |
|
55 { |
|
56 return iServiceName; |
|
57 } |
|
58 |
|
59 TInt CSPEntry::SetServiceName( const TDesC16& aServiceName ) |
|
60 { |
|
61 |
|
62 iServiceName.Copy(aServiceName); |
|
63 return KErrNone; |
|
64 } |
|
65 |
|
66 TInt CSPEntry::AddPropertyL( const CSPProperty& aProperty ) |
|
67 { |
|
68 CSPProperty* property = CSPProperty::NewL(); |
|
69 CleanupStack::PushL( property ); |
|
70 |
|
71 property->CopyL( aProperty ); |
|
72 |
|
73 TInt err = iPropertyArray.Append( property ); |
|
74 if( err == KErrNoMemory ) |
|
75 { |
|
76 User::Leave( KErrNoMemory ); |
|
77 } |
|
78 |
|
79 CleanupStack::Pop( property ); |
|
80 |
|
81 return KErrNone; |
|
82 } |
|
83 |
|
84 |
|
85 TInt CSPEntry::UpdateProperty( TServicePropertyName /*aPropertyName*/, TInt /*aValue*/ ) |
|
86 { |
|
87 return KErrNone; |
|
88 } |
|
89 |
|
90 |
|
91 TInt CSPEntry::UpdateProperty( TServicePropertyName /*aPropertyName*/, const TDesC& /*aValue*/ ) |
|
92 { |
|
93 return KErrNone; |
|
94 } |
|
95 |
|
96 TInt CSPEntry::UpdateProperty( TServicePropertyName /*aPropertyName*/, TOnOff /*aValue*/ ) |
|
97 { |
|
98 return KErrNone; |
|
99 } |
|
100 |
|
101 TInt CSPEntry::GetProperty( const CSPProperty*& aProperty, |
|
102 TServicePropertyName aPropertyName ) const |
|
103 { |
|
104 TInt count = iPropertyArray.Count(); |
|
105 for( TInt i=0; i<count; i++ ) |
|
106 { |
|
107 if( iPropertyArray[ i ]->GetName() == aPropertyName ) |
|
108 { |
|
109 aProperty = iPropertyArray[ i ]; |
|
110 return KErrNone; |
|
111 } |
|
112 } |
|
113 |
|
114 return KErrNotFound; |
|
115 } |
|
116 |
|
117 TInt CSPEntry::GetProperty( const CSPProperty*& /*aProperty*/, |
|
118 TInt /*aIndex*/ ) const |
|
119 { |
|
120 return KErrNone; |
|
121 } |
|
122 |
|
123 TInt CSPEntry::DeleteProperty( TInt /*aIndex*/ ) |
|
124 { |
|
125 return KErrNone; |
|
126 } |
|
127 |
|
128 TInt CSPEntry::DeleteProperty( TServicePropertyName /*aProperty*/ ) |
|
129 { |
|
130 return KErrNone; |
|
131 } |
|
132 |
|
133 const RPropertyArray& CSPEntry::GetAllProperties() const |
|
134 { |
|
135 return iPropertyArray; |
|
136 } |
|
137 |
|
138 TInt CSPEntry::PropertyCount() const |
|
139 { |
|
140 return KErrNone; |
|
141 } |
|
142 |
|
143 CSPEntry::CSPEntry() |
|
144 { |
|
145 } |
|
146 |
|
147 void CSPEntry::ConstructL() |
|
148 { |
|
149 iServiceName.CreateL(500); |
|
150 } |
|
151 |
|
152 TInt CSPEntry::SearchProperty( TServicePropertyName /*aProperty*/ ) const |
|
153 { |
|
154 return KErrNone; |
|
155 } |
|
156 |
|
157 |