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