|
1 // Copyright (c) 1997-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file contains the implementation of |
|
15 // the CImplementationInformation class. |
|
16 // Provide the inline implementation of CImplementationInformation |
|
17 // CImplementationInformation provides access to information on a particular implementation |
|
18 // |
|
19 // |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 |
|
26 Intended Usage : Accessor for this implementation's human readable name |
|
27 @since 7.0 |
|
28 @return The human readable name for this implementation |
|
29 @pre CImplementationInformation is fully constructed and initialized |
|
30 */ |
|
31 const TDesC& CImplementationInformation::DisplayName() const |
|
32 { |
|
33 if(iDisplayName == NULL) |
|
34 return KNullDesC(); |
|
35 else |
|
36 return *iDisplayName; |
|
37 } |
|
38 |
|
39 |
|
40 /** |
|
41 Intended Usage : Accessor for this implementation's default binary data |
|
42 @since 7.0 |
|
43 @return The data type which this implementation supports |
|
44 @pre CImplementationInformation is fully constructed and initialized |
|
45 */ |
|
46 const TDesC8& CImplementationInformation::DataType() const |
|
47 { |
|
48 if(iData == NULL) |
|
49 return KNullDesC8(); |
|
50 else |
|
51 return *iData; |
|
52 } |
|
53 |
|
54 |
|
55 /** |
|
56 Intended Usage : Accessor for this implementation's opaque binary data |
|
57 @since 7.0 |
|
58 @return The opaque data which is available for this implementation |
|
59 @pre CImplementationInformation is fully constructed and initialized |
|
60 */ |
|
61 const TDesC8& CImplementationInformation::OpaqueData() const |
|
62 { |
|
63 if(iOpaqueData == NULL) |
|
64 return KNullDesC8(); |
|
65 else |
|
66 return *iOpaqueData; |
|
67 } |
|
68 |
|
69 |
|
70 /** |
|
71 Intended Usage : Accessor for this implementation's Uid |
|
72 @since 7.0 |
|
73 @return The Uid of this implementation |
|
74 @pre CImplementationInformation is fully constructed and initialized |
|
75 */ |
|
76 TUid CImplementationInformation::ImplementationUid() const |
|
77 { |
|
78 return iImplementationUid; |
|
79 } |
|
80 |
|
81 |
|
82 /** |
|
83 Intended Usage : Accessor for the version number of this implementation |
|
84 @since 7.0 |
|
85 @return The version number of this implementation |
|
86 @pre CImplementationInformation is fully constructed and initialized |
|
87 */ |
|
88 TInt CImplementationInformation::Version() const |
|
89 { |
|
90 return iVersion; |
|
91 } |
|
92 |
|
93 |
|
94 /** |
|
95 Intended Usage : Accessor for whether this implementation is currently |
|
96 disabled |
|
97 @since 7.0 |
|
98 @return Flag indicating whether this implementation is disabled |
|
99 @pre CImplementationInformation is fully constructed and initialized |
|
100 */ |
|
101 TBool CImplementationInformation::Disabled() const |
|
102 { |
|
103 return iDisabled; |
|
104 } |
|
105 |
|
106 |
|
107 /** |
|
108 Intended Usage : Marks this implementation as disabled, or enabled. |
|
109 Note that this function should not be used by any ECOM client side as it will have no effect at all |
|
110 on the implementation information stored in the server side. |
|
111 @since 7.0 |
|
112 @param aDisabled ETrue to indicate this implementation should be disabled, EFalse for enabled. |
|
113 @pre CImplementationInformation is fully constructed and initialized |
|
114 @post Implementation is marked as. |
|
115 */ |
|
116 void CImplementationInformation::SetDisabled(TBool aDisabled) |
|
117 { |
|
118 iDisabled = aDisabled; |
|
119 } |
|
120 |
|
121 /** |
|
122 Intended Usage : Returns the drive that this implementation is installed on |
|
123 Error Condition : None |
|
124 @since 7.0 |
|
125 @return The drive that this implementation is on |
|
126 @pre CImplementationInformation is fully constructed. |
|
127 */ |
|
128 TDriveUnit CImplementationInformation::Drive() const |
|
129 { |
|
130 return iDrive; |
|
131 } |
|
132 |
|
133 |
|
134 /** |
|
135 Intended Usage : Accessor for whether this implementation is to be loaded |
|
136 from ROM only |
|
137 @return Flag indicating whether this implementation is to be loaded from ROM only |
|
138 @pre CImplementationInformation is fully constructed |
|
139 */ |
|
140 TBool CImplementationInformation::RomOnly() const |
|
141 { |
|
142 return iRomOnly; |
|
143 } |
|
144 |
|
145 /** |
|
146 Intended Usage : Accessor for whether this implementation is on ROM or is |
|
147 a later version of one on ROM |
|
148 @return Flag indicating whether this implementation is on ROM or is a later version of one on ROM |
|
149 @pre CImplementationInformation is fully constructed |
|
150 */ |
|
151 TBool CImplementationInformation::RomBased() const |
|
152 { |
|
153 return iRomBased; |
|
154 } |
|
155 /** |
|
156 Intended Usage: Returns the VID of the plug-in that this implementation belongs to. |
|
157 The VID is the VendorId for the plug-in's DLL |
|
158 @pre CImplementationInformation is fully constructed |
|
159 @return VendorId of the plug-in that this implementation belongs to. |
|
160 */ |
|
161 TVendorId CImplementationInformation::VendorId() const |
|
162 { |
|
163 return iVid; |
|
164 } |
|
165 |
|
166 /** |
|
167 Intended Usage: Sets the VID of the plug-in that this implementation belongs to. |
|
168 The VID is the VendorId for the plug-in's DLL. |
|
169 @internalComponent |
|
170 @pre CImplementationInformation is fully constructed |
|
171 @param aVid VendorId of the plug-in that this implementation belongs to. |
|
172 */ |
|
173 void CImplementationInformation::SetVendorId(const TVendorId aVid) |
|
174 { |
|
175 iVid = aVid; |
|
176 } |
|
177 |
|
178 // ____________________________________________________________________________ |
|
179 // Provide the inline implementations of useful utilitiy functions related to |
|
180 // CImplementationInformation for use in client and server sides. |
|
181 // |
|
182 |
|
183 /** |
|
184 Comparison function used in ordering functions (e.g. as used with TLinearOrder) |
|
185 where ECOM UID identified structures are held in ordered RArray/RPointerArray |
|
186 objects. |
|
187 |
|
188 @internalComponent |
|
189 @param aUid1 First UID value of comparison |
|
190 @param aUid2 Second UID Value of comparison |
|
191 @return Returns 1 when aUid1 > aUid2; -1 when aUid1 < aUid2; 0 when they equal |
|
192 */ |
|
193 inline TInt CompareTUidValues(TInt aUid1, TInt aUid2) |
|
194 { |
|
195 // This has been implemented as 'return aUid1-aUid2' previously. |
|
196 // This can lead to overflow problems when comparing 2 signed integers |
|
197 // if the operands are large enough: large aUid minus large negative aUid2 |
|
198 // returns a negative value due to arithmetic overflow of the result when |
|
199 // you'd want a positive value. Hence the longer hand implementation below. |
|
200 if (aUid1 > aUid2) |
|
201 return 1; |
|
202 if (aUid1 < aUid2) |
|
203 return -1; |
|
204 return 0; |
|
205 } |