|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <s32strm.h> |
|
22 #include "mcssuiteobject.h" |
|
23 |
|
24 // ================= MEMBER FUNCTIONS ======================= |
|
25 |
|
26 // --------------------------------------------------------- |
|
27 // CSuiteObject::~CSuiteObject |
|
28 // --------------------------------------------------------- |
|
29 // |
|
30 CSuiteObject::~CSuiteObject() |
|
31 { |
|
32 iAttributes.ResetAndDestroy(); |
|
33 iFileName.Close(); |
|
34 iName.Close(); |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------- |
|
38 // CSuiteObject::NewL |
|
39 // --------------------------------------------------------- |
|
40 // |
|
41 CSuiteObject* CSuiteObject::NewL( const TDesC& aFileName ) |
|
42 { |
|
43 CSuiteObject* attr = NewLC( aFileName ); |
|
44 CleanupStack::Pop( attr ); |
|
45 return attr; |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------- |
|
49 // CSuiteObject::NewLC |
|
50 // --------------------------------------------------------- |
|
51 // |
|
52 CSuiteObject* CSuiteObject::NewLC( const TDesC& aFileName ) |
|
53 { |
|
54 CSuiteObject* attr = new (ELeave) CSuiteObject(); |
|
55 CleanupStack::PushL( attr ); |
|
56 attr->ConstructL( aFileName ); |
|
57 return attr; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------- |
|
61 // CSuiteObject::CSuiteObject |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 CSuiteObject::CSuiteObject() |
|
65 { |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------- |
|
69 // CSuiteObject::ConstructL |
|
70 // --------------------------------------------------------- |
|
71 // |
|
72 void CSuiteObject::ConstructL( const TDesC& aFileName ) |
|
73 { |
|
74 iFileName.CreateL( aFileName ); |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------- |
|
78 // CSuiteObject::SetSuiteNameL |
|
79 // --------------------------------------------------------- |
|
80 // |
|
81 void CSuiteObject::SetSuiteNameL( const TDesC& aName ) |
|
82 { |
|
83 iName.CreateL( aName ); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CSuiteObject::SetInitialAttributeL |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 void CSuiteObject::SetInitialAttributeL( const TDesC& aAttrName, |
|
91 const TDesC& aAttrValue, |
|
92 TBool aLocalized ) |
|
93 { |
|
94 CSuiteObjectAttr* attr = CSuiteObjectAttr::NewLC( aAttrName ); |
|
95 iAttributes.AppendL( attr ); |
|
96 CleanupStack::Pop( attr ); |
|
97 __ASSERT_DEBUG( attr, User::Invariant() ); |
|
98 attr->SetValueL( aAttrValue ); |
|
99 attr->SetLocalized( aLocalized ); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------- |
|
103 // CSuiteObject::GetAttributeL |
|
104 // --------------------------------------------------------- |
|
105 // |
|
106 void CSuiteObject::GetAttribute( const TDesC& aAttrName, |
|
107 TBool& aAttrExists, TDes& aAttrVal ) |
|
108 { |
|
109 aAttrExists = EFalse; |
|
110 TInt attrPos = iAttributes.Find(aAttrName); |
|
111 if (attrPos != KErrNotFound) |
|
112 { |
|
113 aAttrVal.Copy( iAttributes[attrPos]->Value() ); |
|
114 aAttrExists = ETrue; |
|
115 } |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------- |
|
119 // CSuiteObject::CloseSuiteArray |
|
120 // --------------------------------------------------------- |
|
121 // |
|
122 void CSuiteObject::CloseSuiteArray() |
|
123 { |
|
124 iAttributes.ResetAndDestroy(); |
|
125 iAttributes.Close(); |
|
126 } |
|
127 |
|
128 |
|
129 // End of File |