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