|
1 // Copyright (c) 2008-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <cupnpproperty.h> |
|
17 #include "cattribute.h" |
|
18 |
|
19 EXPORT_C void CUPnPProperty::SetPropertyL(const RString aAttributeName, const TDesC8& aAttributeVal) |
|
20 { |
|
21 for ( TInt i =0;i<iAttributeArray.Count();i++) |
|
22 { |
|
23 if ( aAttributeName == iAttributeArray[i]->AttributeName()) |
|
24 { |
|
25 iAttributeArray[i]->SetValueL( aAttributeVal ); |
|
26 return; |
|
27 } |
|
28 } |
|
29 CAttribute* attrib = CAttribute::NewL( aAttributeName , aAttributeVal ); |
|
30 iAttributeArray.AppendL( attrib ); |
|
31 } |
|
32 |
|
33 EXPORT_C void CUPnPProperty::SetPropertyL(const RString aAttributeName, TInt aAttributeVal) |
|
34 { |
|
35 RBuf8 buffer; |
|
36 buffer.CreateL ( sizeof ( TInt ) ); |
|
37 CleanupClosePushL ( buffer ); |
|
38 buffer.AppendNum ( aAttributeVal, EDecimal ); |
|
39 SetPropertyL ( aAttributeName, buffer ); |
|
40 CleanupStack::PopAndDestroy ( &buffer ); |
|
41 } |
|
42 |
|
43 |
|
44 void CUPnPProperty::SetPropertyStatus(const RString aAttributeName, TBool aStatus) |
|
45 { |
|
46 for ( TInt i =0;i<iAttributeArray.Count();i++) |
|
47 { |
|
48 if ( aAttributeName == iAttributeArray[i]->AttributeName()) |
|
49 { |
|
50 iAttributeArray[i]->SetStatus( aStatus ); |
|
51 return; |
|
52 } |
|
53 } |
|
54 } |
|
55 |
|
56 EXPORT_C const TDesC8& CUPnPProperty::Property(const RString aAttributeName) const |
|
57 { |
|
58 for ( TInt i =0;i<iAttributeArray.Count();i++) |
|
59 { |
|
60 if ( aAttributeName == iAttributeArray[i]->AttributeName()) |
|
61 { |
|
62 return (iAttributeArray[i]->AttributeValue()); |
|
63 } |
|
64 } |
|
65 return KNullDesC8; |
|
66 } |
|
67 EXPORT_C CUPnPProperty::~CUPnPProperty() |
|
68 { |
|
69 iAttributeArray.ResetAndDestroy(); |
|
70 } |