epoc32/include/s32std.inl
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/s32std.inl	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/s32std.inl	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,451 @@
     1.4 -s32std.inl
     1.5 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +// Class TStreamId
    1.21 +inline TStreamId::TStreamId(TUint32 aValue)
    1.22 +	: iVal(aValue)
    1.23 +/** Constructs the object with the specified stream ID value.
    1.24 +
    1.25 +Users of stores do not normally use this function.
    1.26 +
    1.27 +In debug mode, the function checks that the supplied stream ID value is not 
    1.28 +greater than the maximum permitted value, and raises a STORE-Store 2 panic 
    1.29 +if it is. In release mode, no checking on the supplied value is done.
    1.30 +
    1.31 +The checking of the supplied value is done by a private function implemented 
    1.32 +in estor. dll. This means that in debug mode, a call is made into estor.dll, 
    1.33 +but in release mode it is not.
    1.34 +
    1.35 +@param aValue The stream ID value. */
    1.36 +	{
    1.37 +#if defined (_DEBUG)
    1.38 +	__DbgChkRange(aValue);
    1.39 +#endif
    1.40 +	}
    1.41 +inline TBool TStreamId::operator==(TStreamId anId) const
    1.42 +/** Equality comparison operator. Use this operator to determine whether this stream 
    1.43 +id is equal to the specified stream id.
    1.44 +
    1.45 +@param anId The stream id to be compared with this stream id.
    1.46 +@return True, if the stream ids are equal; false otherwise */
    1.47 +	{return iVal==anId.iVal;}
    1.48 +inline TBool TStreamId::operator!=(TStreamId anId) const
    1.49 +/** Inequality comparison operator. Use this operator to determine whether this 
    1.50 +stream id is unequal to the specified stream id.
    1.51 +
    1.52 +@param anId The stream id to be compared with this stream id.
    1.53 +@return True, if the two stream ids are unequal, false otherwise. */
    1.54 +	{return iVal!=anId.iVal;}
    1.55 +inline void TStreamId::ExternalizeL(RWriteStream& aStream) const
    1.56 +/** Externalises an object of this class to a write stream.
    1.57 +
    1.58 +The presence of this function means that the standard templated operator<<() 
    1.59 +can be used to externalise objects of this class.
    1.60 +
    1.61 +@param aStream Stream to which the object should be externalised. */
    1.62 +	{
    1.63 +#if defined (_DEBUG)
    1.64 +	__DbgChkRange(iVal);
    1.65 +#endif
    1.66 +	aStream<<iVal;
    1.67 +	}
    1.68 +inline TUint32 TStreamId::Value() const
    1.69 +/** Gets the stream ID value encapsulated by this object.
    1.70 +
    1.71 +@return The stream ID value. */
    1.72 +	{
    1.73 +#if defined (_DEBUG)
    1.74 +	__DbgChkRange(iVal);
    1.75 +#endif
    1.76 +	return iVal;
    1.77 +	}
    1.78 +
    1.79 +// Class RStoreWriteStream
    1.80 +inline RStoreWriteStream::RStoreWriteStream(const MExternalizer<TStreamRef>& anExter)
    1.81 +	: RWriteStream(anExter)
    1.82 +/** Constructs an object with an externaliser. The store map CStoreMap is an example 
    1.83 +of an externalizer.
    1.84 +
    1.85 +@param anExter Specifies an externaliser */
    1.86 +	{}
    1.87 +
    1.88 +// Class TSwizzleCBase
    1.89 +inline TSwizzleCBase::TSwizzleCBase(TStreamRef aRef)
    1.90 +	: iPtr(aRef.Ptr())
    1.91 +	{
    1.92 +#if defined (_DEBUG)
    1.93 +	__DbgChkRef(aRef);
    1.94 +#endif
    1.95 +    }
    1.96 +inline TBool TSwizzleCBase::operator==(const TSwizzleCBase& aSwizzle) const
    1.97 +/** Compares for equality with another swizzle.
    1.98 +
    1.99 +Use this operator to determine whether this swizzle represents the same object 
   1.100 +as that represented by the specified swizzle.
   1.101 +
   1.102 +Both this swizzle and the specified swizzle must maintain the representation 
   1.103 +of their respective objects as either pointers or stream ids.
   1.104 +
   1.105 +If one swizzle maintains the representation of its object as a pointer while 
   1.106 +the other swizzle maintains the representation of its object as a stream id, 
   1.107 +the comparison is meaningless and always returns false.
   1.108 +
   1.109 +@param aSwizzle A reference to the swizzle to be compared with this swizzle.
   1.110 +@return True, if the represented objects are the same; False, otherwise. */
   1.111 +	{return iPtr==aSwizzle.iPtr;}
   1.112 +inline TBool TSwizzleCBase::operator==(const TAny* aPtr) const
   1.113 +/** Compares for equality with an in-memory object.
   1.114 +
   1.115 +Use this operator to determine whether this swizzle represents the same in-memory 
   1.116 +object as that represented by the specified pointer.
   1.117 +
   1.118 +This swizzle must maintain the representation of its object as a pointer. 
   1.119 +If it maintains the representation of its object as a swizzle, the comparison 
   1.120 +is meaningless and always returns false.
   1.121 +
   1.122 +@param aPtr A pointer to the object to be compared with this swizzle.
   1.123 +@return True, if the represented objects are the same; False, otherwise. */
   1.124 +	{return iPtr==aPtr;}
   1.125 +inline TBool TSwizzleCBase::operator!=(const TSwizzleCBase& aSwizzle) const
   1.126 +/** Compares for inequality with another swizzle.
   1.127 +
   1.128 +Use this operator to determine whether this swizzle represents a different 
   1.129 +object to that represented by the specified swizzle.
   1.130 +
   1.131 +Both this swizzle and the specified swizzle must maintain the representation 
   1.132 +of their respective objects as either pointers or stream ids.
   1.133 +
   1.134 +If one swizzle maintains the representation of its object as a pointer while 
   1.135 +the other swizzle maintains the representation of its object as a stream id, 
   1.136 +the comparison is meaningless and always returns true.
   1.137 +
   1.138 +@param aSwizzle A reference to the swizzle to be compared with this swizzle.
   1.139 +@return True, if the represented objects are not the same; False, otherwise */
   1.140 +	{return iPtr!=aSwizzle.iPtr;}
   1.141 +inline TBool TSwizzleCBase::operator!=(const TAny* aPtr) const
   1.142 +/** Compares for inequality with an in-memory object.
   1.143 +
   1.144 +Use this operator to determine whether this swizzle represents a different 
   1.145 +in-memory object to that represented by the specified pointer.
   1.146 +
   1.147 +This swizzle must maintain the representation of its object as a pointer. 
   1.148 +If it maintains the representation of its object as a swizzle, the comparison 
   1.149 +is meaningless and always returns true.
   1.150 +
   1.151 +@param aPtr A pointer to the object to be compared with this swizzle.
   1.152 +@return True, if the represented objects are not the same; False, otherwise */
   1.153 +	{return iPtr!=aPtr;}
   1.154 +inline TBool TSwizzleCBase::IsPtr() const
   1.155 +/** Tests whether this swizzle currently represents an object as a pointer.
   1.156 +
   1.157 +@return True, if this swizzle currently maintains the object representation 
   1.158 +as a pointer; False, otherwise. Note that if the swizzle is uninitialised, 
   1.159 +the value returned by this function is not defined. */
   1.160 +	{return IsPtrRep(iPtr);}
   1.161 +inline TBool TSwizzleCBase::IsId() const
   1.162 +/** Tests whether this swizzle currently represents an object as a stream id.
   1.163 +
   1.164 +@return True, if this swizzle currently maintains the representation of the 
   1.165 +object as a stream id; False, otherwise. Note that if the swizzle is uninitialised, 
   1.166 +the value returned by this function is not defined. */
   1.167 +	{return IsIdRep(iPtr);}
   1.168 +inline TSwizzleCBase::TSwizzleCBase(const TAny* aPtr)
   1.169 +	: iPtr(aPtr)
   1.170 +	{
   1.171 +#if defined (_DEBUG)
   1.172 +	__DbgChkPtr(aPtr);
   1.173 +#endif
   1.174 +    }
   1.175 +inline const TAny* TSwizzleCBase::Ptr() const
   1.176 +	{
   1.177 +#if defined (_DEBUG)
   1.178 +	__DbgChkPtr(iPtr);
   1.179 +#endif
   1.180 +	return iPtr;
   1.181 +	}
   1.182 +inline TBool operator==(const TAny* aPtr,const TSwizzleCBase& aSwizzle)
   1.183 +	{return aSwizzle==aPtr;}
   1.184 +inline TBool operator!=(const TAny* aPtr,const TSwizzleCBase& aSwizzle)
   1.185 +	{return aSwizzle!=aPtr;}
   1.186 +
   1.187 +// Class TSwizzleBase
   1.188 +inline TSwizzleBase::TSwizzleBase(TAny* aPtr)
   1.189 +	: TSwizzleCBase(aPtr)
   1.190 +	{}
   1.191 +inline TSwizzleBase::TSwizzleBase(TStreamId anId)
   1.192 +	: TSwizzleCBase(anId)
   1.193 +	{}
   1.194 +inline TAny* TSwizzleBase::Ptr() const
   1.195 +	{return (TAny*)TSwizzleCBase::Ptr();}
   1.196 +
   1.197 +// Template class TSwizzle
   1.198 +template <class T>
   1.199 +inline TSwizzle<T>::TSwizzle(T* aPtr)
   1.200 +	: TSwizzleBase(aPtr)
   1.201 +/** Constructs a swizzle for a class T type object, represented by a pointer.
   1.202 +
   1.203 +@param aPtr A pointer to a class T type object. */
   1.204 +	{}
   1.205 +template <class T>
   1.206 +inline TSwizzle<T>::TSwizzle(TStreamId anId)
   1.207 +	: TSwizzleBase(anId)
   1.208 +/** Constructs a swizzle for a class T type object, represented as a stream id.
   1.209 +
   1.210 +@param anId The id of a stream containing the external representation of a 
   1.211 +class T type object. */
   1.212 +	{}
   1.213 +template <class T>
   1.214 +inline TSwizzle<T>& TSwizzle<T>::operator=(T* aPtr)
   1.215 +/** Sets this swizzle to represent the in-memory type T object, pointed to by the 
   1.216 +specified T* pointer.
   1.217 +
   1.218 +@param aPtr A pointer to an object of type T which the swizzle is to represent.
   1.219 +@return A reference to this swizzle representing the object of type T. */
   1.220 +	{return *this=TSwizzle<T>(aPtr);}
   1.221 +template <class T>
   1.222 +inline T* TSwizzle<T>::AsPtr() const
   1.223 +/** Returns a pointer to the object which this swizzle represents.
   1.224 +
   1.225 +Note that the indirect component selector operator->() can be used to access 
   1.226 +members of the represented object.
   1.227 +
   1.228 +@return A pointer to the class T type object represented by this swizzle. */
   1.229 +	{return (T*)Ptr();}
   1.230 +template <class T>
   1.231 +inline TSwizzle<T>::operator T*() const
   1.232 +	{return AsPtr();}
   1.233 +template <class T>
   1.234 +inline T& TSwizzle<T>::operator*() const
   1.235 +/** Returns a reference to the type T object which this swizzle represents.
   1.236 +
   1.237 +@return A reference to the type T object represented by this swizzle. */
   1.238 +	{return *AsPtr();}
   1.239 +template <class T>
   1.240 +inline T* TSwizzle<T>::operator->() const
   1.241 +/** Gives access to members of the type T object which this swizzle represents.
   1.242 +
   1.243 +Note, use the AsPtr() member function to return a pointer to the object itself.
   1.244 +
   1.245 +@return A pointer to the T type object; not explicitly accessible. */
   1.246 +	{return AsPtr();}
   1.247 +template <class T>
   1.248 +inline void TSwizzle<T>::ExternalizeL(RWriteStream& aStream) const
   1.249 +/** Externalises the stream id of the stream associated with this swizzle.
   1.250 +
   1.251 +This function presupposes that: 
   1.252 +
   1.253 +a store map, i.e. an object of type CStoreMap, has been constructed
   1.254 +
   1.255 +the id of the stream containing the external representation of the represented 
   1.256 +type T object has been bound to this swizzle and added to the store map.
   1.257 +
   1.258 +the concrete stream referenced by aStream has been constructed, specifying 
   1.259 +the store map as an externaliser.
   1.260 +
   1.261 +The presence of this function means that the standard templated operator<<() 
   1.262 +can be used.
   1.263 +
   1.264 +@param aStream Stream to which the stream id should be externalised.
   1.265 +@see CStoreMap */
   1.266 +	{TSwizzleBase::DoExternalizeL(aStream,TExternalizer<T>::Function());}
   1.267 +inline TSwizzle<TAny>::TSwizzle(TAny* aPtr)
   1.268 +	: TSwizzleBase(aPtr)
   1.269 +/** Constructs the swizzle representing the specified untyped object as a pointer.
   1.270 +	
   1.271 +@param aPtr A pointer to an untyped object which this swizzle is to represent. */
   1.272 +	{}
   1.273 +inline TSwizzle<TAny>::TSwizzle(TStreamId anId)
   1.274 +	: TSwizzleBase(anId)
   1.275 +/** Constructs the swizzle for an untyped object, represented as a stream id.
   1.276 +	
   1.277 +@param anId The id of a stream containing the external representation of the 
   1.278 +	untyped object which this swizzle is to represent. */
   1.279 +	{}
   1.280 +inline TSwizzle<TAny>::TSwizzle(const TSwizzleBase& aSwizzle)
   1.281 +	: TSwizzleBase(aSwizzle)
   1.282 +/** Constructs the swizzle to represent the untyped object currently represented 
   1.283 +	by the specified swizzle.
   1.284 +	
   1.285 +@param aSwizzle A reference to a swizzle whose representation of an object 
   1.286 +	is to be copied to this swizzle */
   1.287 +	{}
   1.288 +inline TSwizzle<TAny>& TSwizzle<TAny>::operator=(TAny* aPtr)
   1.289 +/** Sets this swizzle to represent the in-memory object, pointed to by the specified 
   1.290 +	pointer.
   1.291 +	
   1.292 +@param aPtr A pointer to the untyped object which the swizzle is to represent.
   1.293 +@return A reference to this swizzle. */
   1.294 +	{return *this=TSwizzle<TAny>(aPtr);}
   1.295 +inline TSwizzle<TAny>& TSwizzle<TAny>::operator=(const TSwizzleBase& aSwizzle)
   1.296 +	/** Sets the swizzle to represent the untyped object currently represented by the 
   1.297 +	specified swizzle.
   1.298 +	
   1.299 +	@param aSwizzle The swizzle whose representation of an object is to be copied 
   1.300 +	to this swizzle.
   1.301 +	@return A reference to this swizzle. */
   1.302 +	{return *this=TSwizzle<TAny>(aSwizzle);}
   1.303 +inline TAny* TSwizzle<TAny>::AsPtr() const
   1.304 +/** Returns a pointer to the untyped object that this swizzle represents.
   1.305 +	
   1.306 +	@return A pointer to the untyped object represented by this swizzle. */
   1.307 +	{return Ptr();}
   1.308 +inline TSwizzle<TAny>::operator TAny*() const
   1.309 +	{return AsPtr();}
   1.310 +
   1.311 +// Template class TSwizzleC
   1.312 +template <class T>
   1.313 +inline TSwizzleC<T>::TSwizzleC(const T* aPtr)
   1.314 +	: TSwizzleCBase(aPtr)
   1.315 +/** Constructs a swizzle for a class T type object and represents the object by 
   1.316 +pointer.
   1.317 +
   1.318 +@param aPtr A pointer to a class T type object. */
   1.319 +	{}
   1.320 +template <class T>
   1.321 +inline TSwizzleC<T>::TSwizzleC(TStreamId anId)
   1.322 +	: TSwizzleCBase(anId)
   1.323 +/** Constructs a swizzle for a class T type object and represents the object as 
   1.324 +a stream id.
   1.325 +
   1.326 +@param anId The stream id of a stream containing the external representation 
   1.327 +of an object of type class T. */
   1.328 +	{}
   1.329 +template <class T>
   1.330 +inline TSwizzleC<T>::TSwizzleC(TSwizzle<T> aSwizzle)
   1.331 +	: TSwizzleCBase(aSwizzle)
   1.332 +/** Constructs a swizzle for a class T type object that is currently represented 
   1.333 +by another swizzle.
   1.334 +
   1.335 +The representation of the class T type object is the same as its representation 
   1.336 +by the specified swizzle, i.e. if the specified swizzle represents the object 
   1.337 +as a pointer, then this newly constructed swizzle also represents the object 
   1.338 +as a pointer.
   1.339 +
   1.340 +@param aSwizzle The swizzle whose representation of the class T type object 
   1.341 +is to be copied to this swizzle. */
   1.342 +	{}
   1.343 +template <class T>
   1.344 +inline TSwizzleC<T>& TSwizzleC<T>::operator=(const T* aPtr)
   1.345 +/** Sets this swizzle to represent the in-memory type T object, pointed to by the 
   1.346 +specified T* pointer.
   1.347 +
   1.348 +@param aPtr A pointer to an object of type T which the swizzle is to represent.
   1.349 +@return A reference to this swizzle representing the object of type T.
   1.350 +@see TSwizzle::operator=() */
   1.351 +	{return *this=TSwizzleC<T>(aPtr);}
   1.352 +template <class T>
   1.353 +inline const T* TSwizzleC<T>::AsPtr() const
   1.354 +/** Returns a constant pointer to the object which this swizzle represents.
   1.355 +
   1.356 +Note:
   1.357 +
   1.358 +The in memory object cannot be changed through this swizzle.
   1.359 +
   1.360 +To access members of the object, the indirect component selector operator->() 
   1.361 +can be used.
   1.362 +
   1.363 +@return A const pointer to the class T type object represented by this swizzle. */
   1.364 +	{return (const T*)Ptr();}
   1.365 +template <class T>
   1.366 +inline TSwizzleC<T>::operator const T*() const
   1.367 +	{return AsPtr();}
   1.368 +template <class T>
   1.369 +inline const T& TSwizzleC<T>::operator*() const
   1.370 +/** Returns a const reference to the type T object which this swizzle represents.
   1.371 +
   1.372 +@return A const reference to the type T object represented by this swizzle.
   1.373 +@see TSwizzle::operator*() */
   1.374 +	{return *AsPtr();}
   1.375 +template <class T>
   1.376 +inline const T* TSwizzleC<T>::operator->() const
   1.377 +/** Gives access to members of the type T object which this swizzle represents.
   1.378 +
   1.379 +Note:
   1.380 +
   1.381 +use the AsPtr() member function to return a pointer to the object itself.
   1.382 +
   1.383 +the type T object cannot be changed through this operator.
   1.384 +
   1.385 +@return A const pointer to the T type object; not explicitly accessible.
   1.386 +@see TSwizzle::operator->() */
   1.387 +	{return AsPtr();}
   1.388 +template <class T>
   1.389 +inline void TSwizzleC<T>::ExternalizeL(RWriteStream& aStream) const
   1.390 +/** Externalises the stream id of the stream associated with this swizzle.
   1.391 +
   1.392 +This function presupposes that: 
   1.393 +
   1.394 +a store map, i.e. an object of type CStoreMap, has been constructed
   1.395 +
   1.396 +the id of the stream containing the external representation of the <class T> 
   1.397 +object has been bound to this swizzle and added to the store map.
   1.398 +
   1.399 +the concrete stream referenced by aStream has been constructed, specifying 
   1.400 +the store map as an externalizer.
   1.401 +
   1.402 +The presence of this function means that the standard templated operator<<() 
   1.403 +can be used.
   1.404 +
   1.405 +@param aStream Stream to which the stream id should be externalised
   1.406 +@see CStoreMap */
   1.407 +	{TSwizzleCBase::DoExternalizeL(aStream,TExternalizer<T>::Function());}
   1.408 +inline TSwizzleC<TAny>::TSwizzleC(const TAny* aPtr)
   1.409 +	: TSwizzleCBase(aPtr)
   1.410 +/** Constructs the swizzle representing the specified untyped object as a pointer.
   1.411 +	
   1.412 +@param aPtr A pointer to an untyped object which this swizzle is to represent. */
   1.413 +	{}
   1.414 +inline TSwizzleC<TAny>::TSwizzleC(TStreamId anId)
   1.415 +	: TSwizzleCBase(anId)
   1.416 +/** Constructs the swizzle for an untyped object, represented as a stream id.
   1.417 +	
   1.418 +@param anId The id of a stream containing the external representation of the 
   1.419 +	untyped object which this swizzle is to represent. */
   1.420 +	{}
   1.421 +inline TSwizzleC<TAny>::TSwizzleC(const TSwizzleCBase& aSwizzle)
   1.422 +	: TSwizzleCBase(aSwizzle)
   1.423 +/** Constructs the swizzle to represent the untyped object currently represented 
   1.424 +	by the specified swizzle.
   1.425 +	
   1.426 +@param aSwizzle The swizzle whose representation of an object is to be copied 
   1.427 +	to this swizzle. */
   1.428 +	{}
   1.429 +inline TSwizzleC<TAny>::TSwizzleC(TStreamRef aRef)
   1.430 +	: TSwizzleCBase(aRef)
   1.431 +/** Constructs the swizzle from a stream reference.
   1.432 +	
   1.433 +@param aRef The stream reference. */
   1.434 + 	{}
   1.435 +inline TSwizzleC<TAny>& TSwizzleC<TAny>::operator=(const TAny* aPtr)
   1.436 +/** Sets this swizzle to represent the specified in-memory untyped object.
   1.437 +	
   1.438 +@param aPtr A pointer to the untyped object that the swizzle is to represent.
   1.439 +@return A reference to this swizzle representing the untyped object. */
   1.440 +	{return *this=TSwizzleC<TAny>(aPtr);}
   1.441 +inline TSwizzleC<TAny>& TSwizzleC<TAny>::operator=(const TSwizzleCBase& aSwizzle)
   1.442 +/** Sets this swizzle to represent the untyped object currently represented by the 
   1.443 +	specific swizzle.
   1.444 +	
   1.445 +@param aSwizzle A pointer to the untyped object that the swizzle is to represent.
   1.446 +@return A reference to a swizzle whose representation of an object is to be 
   1.447 +	copied to this swizzle. */
   1.448 +	{return *this=TSwizzleC<TAny>(aSwizzle);}
   1.449 +inline const TAny* TSwizzleC<TAny>::AsPtr() const
   1.450 +/** Gets a constant pointer to the untyped object that this swizzle represents.
   1.451 +	
   1.452 +@return A const pointer to the untyped object represented by this swizzle. */
   1.453 +	{return Ptr();}
   1.454 +inline TSwizzleC<TAny>::operator const TAny*() const
   1.455 +	{return AsPtr();}