|
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 "cattribute.h" |
|
17 |
|
18 CAttribute* CAttribute::NewL(const RString aAttributeName, const TDesC8& aAttributeVal) |
|
19 { |
|
20 return new(ELeave)CAttribute(aAttributeName, aAttributeVal); |
|
21 } |
|
22 |
|
23 CAttribute::~CAttribute() |
|
24 { |
|
25 iAttributeName.Close(); |
|
26 iAttributeValue.Close(); |
|
27 } |
|
28 |
|
29 const RString& CAttribute::AttributeName() const |
|
30 { |
|
31 return iAttributeName; |
|
32 } |
|
33 |
|
34 const TDesC8& CAttribute::AttributeValue() const |
|
35 { |
|
36 return iAttributeValue; |
|
37 } |
|
38 |
|
39 void CAttribute::SetValueL(const TDesC8& aAttributeVal) |
|
40 { |
|
41 if(iParsedStatus) |
|
42 { |
|
43 iAttributeValue.Close(); |
|
44 iAttributeValue.Create(aAttributeVal.Length()); |
|
45 iAttributeValue.Copy(aAttributeVal); |
|
46 iParsedStatus = EFalse; |
|
47 } |
|
48 else |
|
49 { |
|
50 TInt len = iAttributeValue.Length(); |
|
51 iAttributeValue.ReAllocL( len + aAttributeVal.Length() ); |
|
52 iAttributeValue.Append ( aAttributeVal ); |
|
53 } |
|
54 } |
|
55 |
|
56 void CAttribute::SetStatus(TBool aStatus) |
|
57 { |
|
58 iParsedStatus = aStatus; |
|
59 } |
|
60 |
|
61 CAttribute::CAttribute(RString aAttributeName, const TDesC8& aAttributeVal) |
|
62 { |
|
63 iAttributeName = aAttributeName.Copy(); |
|
64 iAttributeValue.Create(aAttributeVal.Length()); |
|
65 iAttributeValue.Copy(aAttributeVal); |
|
66 } |
|
67 |