sl@0: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\e32std.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __E32STD_H__ sl@0: #define __E32STD_H__ sl@0: sl@0: #ifdef __KERNEL_MODE__ sl@0: #error !! Including e32std.h in kernel code !! sl@0: #endif sl@0: sl@0: #include sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TFunctor sl@0: { sl@0: public: sl@0: IMPORT_C virtual void operator()() =0; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Encapsulates a general call-back function. sl@0: sl@0: The class encapsulates: sl@0: sl@0: 1. a pointer to a function which takes an argument of type TAny* and returns sl@0: a TInt. sl@0: sl@0: 2. a pointer which is passed to the function every time it is called. sl@0: The pointer can point to any object. It can also be NULL. sl@0: sl@0: The callback function can be a static function of a class, sl@0: e.g. TInt X::Foo(TAny *) or it can be a function which is not a member of sl@0: any class, e.g. TInt Foo(TAny *). sl@0: sl@0: When used with the CIdle and the CPeriodic classes, the callback function sl@0: is intended to be called repeatedly; the encapsulated pointer is passed on sl@0: each call. Typically, the pointer refers to an object which records the state sl@0: of the task across each call. When used with CIdle, the callback function sl@0: should also return a true (non-zero) value if it is intended to be called sl@0: again, otherwise it should return a false (zero) value. sl@0: sl@0: @see CIdle sl@0: @see CPeriodic sl@0: */ sl@0: class TCallBack sl@0: { sl@0: public: sl@0: inline TCallBack(); sl@0: inline TCallBack(TInt (*aFunction)(TAny* aPtr)); sl@0: inline TCallBack(TInt (*aFunction)(TAny* aPtr),TAny* aPtr); sl@0: inline TInt CallBack() const; sl@0: public: sl@0: sl@0: /** sl@0: A pointer to the callback function. sl@0: */ sl@0: TInt (*iFunction)(TAny* aPtr); sl@0: sl@0: sl@0: /** sl@0: A pointer that is passed to the callback function when sl@0: the function is called. sl@0: */ sl@0: TAny* iPtr; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An object embedded within a class T so that objects of type T can form part sl@0: of a singly linked list. sl@0: sl@0: A link object encapsulates a pointer to the next link object in the list. sl@0: sl@0: @see TSglQue sl@0: */ sl@0: class TSglQueLink sl@0: { sl@0: #if defined _DEBUG sl@0: public: sl@0: inline TSglQueLink() : iNext(NULL) sl@0: /** sl@0: An explicitly coded default constructor that is only defined for DEBUG builds. sl@0: sl@0: It sets the pointer to the next link object to NULL. sl@0: sl@0: @see iNext sl@0: */ sl@0: {} sl@0: #endif sl@0: private: sl@0: IMPORT_C void Enque(TSglQueLink* aLink); sl@0: public: sl@0: /** sl@0: A pointer to the next link object in the list. sl@0: */ sl@0: TSglQueLink* iNext; sl@0: friend class TSglQueBase; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that provides implementation for the link object of a doubly sl@0: linked list. sl@0: sl@0: It also encapsulates pointers both to the next and the previous link sl@0: objects in the doubly linked list. sl@0: sl@0: The class is abstract and is not intended to be instantiated. sl@0: sl@0: @see TDblQueLink sl@0: */ sl@0: class TDblQueLinkBase sl@0: { sl@0: public: sl@0: inline TDblQueLinkBase() : iNext(NULL) sl@0: /** sl@0: Default constructor. sl@0: sl@0: It sets the pointer to the next link object to NULL. sl@0: sl@0: @see iNext sl@0: */ sl@0: {} sl@0: IMPORT_C void Enque(TDblQueLinkBase* aLink); sl@0: IMPORT_C void AddBefore(TDblQueLinkBase* aLink); sl@0: public: sl@0: /** sl@0: A pointer to the next link object in the list. sl@0: */ sl@0: TDblQueLinkBase* iNext; sl@0: sl@0: /** sl@0: A pointer to the previous link object in the list. sl@0: */ sl@0: TDblQueLinkBase* iPrev; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An object embedded within a class T so that objects of type T can form part sl@0: of a doubly linked list. sl@0: */ sl@0: class TDblQueLink : public TDblQueLinkBase sl@0: { sl@0: public: sl@0: IMPORT_C void Deque(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An object embedded within a class T so that objects of type T can form part sl@0: of an ordered doubly linked list. sl@0: sl@0: Objects are added to the doubly linked list in descending priority order. sl@0: */ sl@0: class TPriQueLink : public TDblQueLink sl@0: { sl@0: public: sl@0: /** sl@0: The priority value. sl@0: sl@0: Objects are added to the doubly linked list in descending order of this value. sl@0: */ sl@0: TInt iPriority; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An object embedded within a class T so that objects of type T can form part sl@0: of a delta doubly linked list. sl@0: */ sl@0: class TDeltaQueLink : public TDblQueLinkBase sl@0: { sl@0: public: sl@0: /** sl@0: The delta value. sl@0: */ sl@0: TInt iDelta; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An object embedded within a class T so that objects of type T can form part sl@0: of a doubly linked list sorted by tick count. sl@0: */ sl@0: class TTickCountQueLink : public TDblQueLink sl@0: { sl@0: public: sl@0: /** sl@0: The tick count. sl@0: */ sl@0: TUint iTickCount; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that provides implementation for the singly linked list header. sl@0: sl@0: It also encapsulates the offset value of a link object. sl@0: sl@0: The class is abstract and is not intended to be instantiated. sl@0: sl@0: @see TSglQue sl@0: */ sl@0: class TSglQueBase sl@0: { sl@0: public: sl@0: IMPORT_C TBool IsEmpty() const; sl@0: IMPORT_C void SetOffset(TInt aOffset); sl@0: IMPORT_C void Reset(); sl@0: protected: sl@0: IMPORT_C TSglQueBase(); sl@0: IMPORT_C TSglQueBase(TInt aOffset); sl@0: IMPORT_C void DoAddFirst(TAny* aPtr); sl@0: IMPORT_C void DoAddLast(TAny* aPtr); sl@0: IMPORT_C void DoRemove(TAny* aPtr); sl@0: protected: sl@0: /** sl@0: A pointer to the first element in the list. sl@0: */ sl@0: TSglQueLink* iHead; sl@0: sl@0: /** sl@0: A pointer to the last element in the list. sl@0: */ sl@0: TSglQueLink* iLast; sl@0: sl@0: /** sl@0: The offset of a component link object within elements that form the list. sl@0: */ sl@0: TInt iOffset; sl@0: private: sl@0: TSglQueBase(const TSglQueBase& aQue); sl@0: TSglQueBase &operator=(const TSglQueBase& aQue); sl@0: friend class TSglQueIterBase; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that provides implementation for the doubly linked list header. sl@0: sl@0: It also encapsulates the offset value of a link object. sl@0: sl@0: The class is abstract and is not intended to be instantiated. sl@0: sl@0: @see TDblQue sl@0: */ sl@0: class TDblQueBase sl@0: { sl@0: public: sl@0: IMPORT_C TBool IsEmpty() const; sl@0: IMPORT_C void SetOffset(TInt aOffset); sl@0: IMPORT_C void Reset(); sl@0: protected: sl@0: IMPORT_C TDblQueBase(); sl@0: IMPORT_C TDblQueBase(TInt aOffset); sl@0: IMPORT_C void DoAddFirst(TAny* aPtr); sl@0: IMPORT_C void DoAddLast(TAny* aPtr); sl@0: IMPORT_C void DoAddPriority(TAny* aPtr); sl@0: IMPORT_C void __DbgTestEmpty() const; sl@0: protected: sl@0: /** sl@0: The head, or anchor point of the queue. sl@0: */ sl@0: TDblQueLink iHead; sl@0: sl@0: /** sl@0: The offset of a component link object within elements that form the list. sl@0: */ sl@0: TInt iOffset; sl@0: private: sl@0: TDblQueBase(const TDblQueBase& aQue); sl@0: TDblQueBase& operator=(const TDblQueBase& aQue); sl@0: friend class TDblQueIterBase; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that provides implementation for the TDeltaQue template class. sl@0: sl@0: The class is abstract and is not intended to be instantiated. sl@0: sl@0: @see TDeltaQue sl@0: */ sl@0: class TDeltaQueBase : public TDblQueBase sl@0: { sl@0: public: sl@0: IMPORT_C TBool CountDown(); sl@0: IMPORT_C TBool CountDown(TInt aValue); sl@0: IMPORT_C TBool FirstDelta(TInt& aValue); sl@0: IMPORT_C void Reset(); sl@0: protected: sl@0: IMPORT_C TDeltaQueBase(); sl@0: IMPORT_C TDeltaQueBase(TInt aOffset); sl@0: IMPORT_C void DoAddDelta(TAny* aPtr,TInt aDelta); sl@0: IMPORT_C void DoRemove(TAny* aPtr); sl@0: IMPORT_C TAny* DoRemoveFirst(); sl@0: protected: sl@0: /** sl@0: Pointer to the delta value in the first link element. sl@0: */ sl@0: TInt* iFirstDelta; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A templated class that provides the behaviour for managing a singly linked sl@0: list. sl@0: sl@0: It also acts as the head of the list, maintaining the pointers into the list. sl@0: sl@0: The template parameter defines the type of element that forms the singly linked sl@0: list and is the class that acts as host to the link object. sl@0: sl@0: @see TSglQueLink sl@0: */ sl@0: template sl@0: class TSglQue : public TSglQueBase sl@0: { sl@0: public: sl@0: inline TSglQue(); sl@0: inline explicit TSglQue(TInt aOffset); sl@0: inline void AddFirst(T& aRef); sl@0: inline void AddLast(T& aRef); sl@0: inline TBool IsFirst(const T* aPtr) const; sl@0: inline TBool IsLast(const T* aPtr) const; sl@0: inline T* First() const; sl@0: inline T* Last() const; sl@0: inline void Remove(T& aRef); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A templated class that provides the behaviour for managing a doubly linked sl@0: list. sl@0: sl@0: It also acts as the head of the list, maintaining the pointers into the list. sl@0: sl@0: The template parameter defines the type of element that forms the doubly linked sl@0: list and is the class that acts as host to the link object. sl@0: sl@0: @see TDblQueLink sl@0: */ sl@0: template sl@0: class TDblQue : public TDblQueBase sl@0: { sl@0: public: sl@0: inline TDblQue(); sl@0: inline explicit TDblQue(TInt aOffset); sl@0: inline void AddFirst(T& aRef); sl@0: inline void AddLast(T& aRef); sl@0: inline TBool IsHead(const T* aPtr) const; sl@0: inline TBool IsFirst(const T* aPtr) const; sl@0: inline TBool IsLast(const T* aPtr) const; sl@0: inline T* First() const; sl@0: inline T* Last() const; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A templated class that provides the behaviour for managing a doubly linked sl@0: list in which the elements are added in descending priority order. sl@0: sl@0: Priority is defined by the value of the TPriQueLink::iPriority member of sl@0: the link element. sl@0: sl@0: The template parameter defines the type of element that forms the doubly linked sl@0: list and is the class that acts as host to the link object. sl@0: sl@0: @see TPriQueLink sl@0: @see TPriQueLink::iPriority sl@0: */ sl@0: template sl@0: class TPriQue : public TDblQueBase sl@0: { sl@0: public: sl@0: inline TPriQue(); sl@0: inline explicit TPriQue(TInt aOffset); sl@0: inline void Add(T& aRef); sl@0: inline TBool IsHead(const T* aPtr) const; sl@0: inline TBool IsFirst(const T* aPtr) const; sl@0: inline TBool IsLast(const T* aPtr) const; sl@0: inline T* First() const; sl@0: inline T* Last() const; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A templated class that provides the behaviour for managing a doubly linked sl@0: list in which elements represent values which are increments, or deltas, on sl@0: the value represented by a preceding element. sl@0: sl@0: The list is ordered so that the head of the queue represents a nominal zero sl@0: point. sl@0: sl@0: The delta value of a new element represents its 'distance' from the nominal sl@0: zero point. The new element is added into the list, and the delta values of sl@0: adjacent elements (and of the new element, if necessary) are adjusted, so sl@0: that the sum of all deltas, up to and including the new element, is the same sl@0: as the new element's intended 'distance' from the nominal zero point. sl@0: sl@0: A common use for a list of this type is as a queue of timed events, where sl@0: the delta values represent the intervals between the events. sl@0: sl@0: The delta value is defined by the value of the TDeltaQueLink::iDelta member sl@0: of the link element. sl@0: sl@0: The template parameter defines the type of element that forms the doubly linked sl@0: list and is the class that acts as host to the link object. sl@0: sl@0: @see TDeltaQueLink sl@0: @see TDeltaQueLink::iDelta sl@0: */ sl@0: template sl@0: class TDeltaQue : public TDeltaQueBase sl@0: { sl@0: public: sl@0: inline TDeltaQue(); sl@0: inline explicit TDeltaQue(TInt aOffset); sl@0: inline void Add(T& aRef,TInt aDelta); sl@0: inline void Remove(T& aRef); sl@0: inline T* RemoveFirst(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: // Forward declaration sl@0: class TTickCountQueLink; sl@0: sl@0: /** sl@0: @internalComponent sl@0: @released sl@0: sl@0: A class that provides the behaviour for managing a doubly linked list sl@0: in which elements are added in order of the time until their tick count. sl@0: sl@0: A common use for a list of this type is as a queue of timed events, where sl@0: the tick counts are the expiry times of the events. sl@0: sl@0: The tick count is defined by the value of the TTickCountQueLink::iTickCount sl@0: member of the link element. sl@0: sl@0: @see TTickCountQueLink sl@0: @see TTickCountQueLink::iTickCount sl@0: */ sl@0: class TTickCountQue : public TDblQueBase sl@0: { sl@0: public: sl@0: TTickCountQue(); sl@0: void Add(TTickCountQueLink& aRef); sl@0: TTickCountQueLink* First() const; sl@0: TTickCountQueLink* RemoveFirst(); sl@0: TTickCountQueLink* RemoveFirst(TUint aTickCount); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that provides implementation for the singly linked list iterator. sl@0: sl@0: It also encapsulates a pointer to the current link link list element. sl@0: sl@0: The class is abstract and is not intended to be instantiated. sl@0: */ sl@0: class TSglQueIterBase sl@0: { sl@0: public: sl@0: IMPORT_C void SetToFirst(); sl@0: protected: sl@0: IMPORT_C TSglQueIterBase(TSglQueBase& aQue); sl@0: IMPORT_C TAny* DoPostInc(); sl@0: IMPORT_C TAny* DoCurrent(); sl@0: IMPORT_C void DoSet(TAny* aLink); sl@0: protected: sl@0: TInt iOffset; sl@0: TSglQueLink* iHead; sl@0: TSglQueLink* iNext; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A templated class that provides the behaviour for iterating through a set of sl@0: singly linked list elements. sl@0: sl@0: The template parameter defines the type of element that forms the singly linked sl@0: list. The class defined in the template parameter contains the link object. sl@0: */ sl@0: template sl@0: class TSglQueIter : public TSglQueIterBase sl@0: { sl@0: public: sl@0: inline TSglQueIter(TSglQueBase& aQue); sl@0: inline void Set(T& aLink); sl@0: inline operator T*(); sl@0: inline T* operator++(TInt); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that provides implementation for the doubly linked list iterator. sl@0: sl@0: It also encapsulates a pointer to the current link list element. sl@0: sl@0: The class is abstract and is not intended to be instantiated. sl@0: */ sl@0: class TDblQueIterBase sl@0: { sl@0: public: sl@0: IMPORT_C void SetToFirst(); sl@0: IMPORT_C void SetToLast(); sl@0: protected: sl@0: IMPORT_C TDblQueIterBase(TDblQueBase& aQue); sl@0: IMPORT_C TAny* DoPostInc(); sl@0: IMPORT_C TAny* DoPostDec(); sl@0: IMPORT_C TAny* DoCurrent(); sl@0: IMPORT_C void DoSet(TAny* aLink); sl@0: protected: sl@0: /** sl@0: The offset of a component link object within elements that form the list. sl@0: */ sl@0: TInt iOffset; sl@0: sl@0: /** sl@0: Pointer to the anchor for the list. sl@0: */ sl@0: TDblQueLinkBase* iHead; sl@0: sl@0: /** sl@0: Pointer to the current element. sl@0: */ sl@0: TDblQueLinkBase* iNext; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A templated class that provides the behaviour for iterating through a set of sl@0: doubly linked list elements. sl@0: sl@0: The template parameter defines the type of element that forms the doubly linked sl@0: list. The class defined in the template parameter contains the link object. sl@0: */ sl@0: template sl@0: class TDblQueIter : public TDblQueIterBase sl@0: { sl@0: public: sl@0: inline TDblQueIter(TDblQueBase& aQue); sl@0: inline void Set(T& aLink); sl@0: inline operator T*(); sl@0: inline T* operator++(TInt); sl@0: inline T* operator--(TInt); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Governs the type of comparison to be made between descriptor keys or between sl@0: text keys. sl@0: sl@0: @see TKeyArrayFix sl@0: @see TKeyArrayVar sl@0: @see TKeyArrayPak sl@0: */ sl@0: enum TKeyCmpText sl@0: { sl@0: /** sl@0: For a Unicode build, this is the same as ECmpNormal16. sl@0: For a non-Unicode build, this is the same as ECmpNormal8. sl@0: sl@0: Using the build independent names (i.e. TPtrC, TPtr, TBufC, TBuf or TText) sl@0: allows the compiler to chose the correct variant according to the build. sl@0: */ sl@0: ECmpNormal, sl@0: sl@0: sl@0: /** sl@0: For descriptor keys, the key is assumed to be the 8 bit variant, derived sl@0: from TDesc8. A simple comparison is done between the content of the sl@0: descriptors; the data is not folded and collation rules are not applied for sl@0: the purpose of the comparison. sl@0: sl@0: For text keys, the key is assumed to be the 8 bit variant, of type TText8. sl@0: A normal comparison is done between the text data; the data is not folded sl@0: and collation rules are not applied for the purpose of the comparison. sl@0: */ sl@0: ECmpNormal8, sl@0: sl@0: sl@0: /** sl@0: For descriptor keys, the key is assumed to be the 16 bit variant, derived sl@0: from TDesc16. A simple comparison is done between the content of the sl@0: descriptors; the data is not folded and collation rules are not applied for sl@0: the purpose of the comparison. sl@0: sl@0: For text keys, the key is assumed to be the 16 bit variant, of type sl@0: TText16. A normal comparison is done between the text data; the data is sl@0: not folded and collation rules are not applied for the purpose of the sl@0: comparison. sl@0: */ sl@0: ECmpNormal16, sl@0: sl@0: sl@0: /** sl@0: For a Unicode build, this is the same as EcmpFolded16. sl@0: For a non-Unicode build, this is the same as EcmpFolded8. sl@0: sl@0: Using the build independent names (i.e. TPtrC, TPtr, TBufC, TBuf or TText) sl@0: allows the compiler to chose the correct variant according to the build. sl@0: */ sl@0: ECmpFolded, sl@0: sl@0: sl@0: /** sl@0: For descriptor keys, the key is assumed to be the 8 bit variant, sl@0: derived from TDesc8. The descriptor contents are folded for the purpose sl@0: of the comparison. sl@0: sl@0: For text keys, the key is assumed to be the 8 bit variant, of type sl@0: TText8. The text data is folded for the purpose of the comparison. sl@0: */ sl@0: ECmpFolded8, sl@0: sl@0: sl@0: /** sl@0: For descriptor keys, the key is assumed to be the 16 bit variant, sl@0: derived from TDesc16. The descriptor contents are folded for the purpose sl@0: of the comparison. sl@0: sl@0: For text keys, the key is assumed to be the 16 bit variant, of type sl@0: TText16. The text data is folded for the purpose of the comparison. sl@0: */ sl@0: ECmpFolded16, sl@0: sl@0: sl@0: /** sl@0: For a Unicode build, this is the same as EcmpCollated16. sl@0: For a non-Unicode build, this is the same as EcmpCollated8. sl@0: sl@0: Using the build independent names (i.e. TPtrC, TPtr, TBufC, TBuf or TText) sl@0: allows the compiler to chose the correct variant according to the build. sl@0: */ sl@0: ECmpCollated, sl@0: sl@0: sl@0: /** sl@0: For descriptor keys, the key is assumed to be the 8 bit variant, sl@0: derived from TDesc8. Collation rules are applied for the purpose of sl@0: the comparison. sl@0: sl@0: For text keys, the key is assumed to be the 8 bit variant, of type sl@0: TText8. Collation rules are applied for the purpose of the comparison. sl@0: */ sl@0: ECmpCollated8, sl@0: sl@0: sl@0: /** sl@0: For descriptor keys, the key is assumed to be the 16 bit variant, sl@0: derived from TDesc16. Collation rules are applied for the purpose of sl@0: the comparison. sl@0: sl@0: For text keys, the key is assumed to be the 16 bit variant, sl@0: of type TText16. Collation rules are applied for the purpose of sl@0: the comparison. sl@0: */ sl@0: ECmpCollated16 sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Governs the type of comparison to be made between numeric keys. sl@0: sl@0: @see TKeyArrayFix sl@0: @see TKeyArrayVar sl@0: @see TKeyArrayPak sl@0: */ sl@0: enum TKeyCmpNumeric sl@0: { sl@0: /** sl@0: The key is assumed to be of type TInt8. sl@0: */ sl@0: ECmpTInt8=((ECmpCollated16+1)<<1), sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TInt16. sl@0: */ sl@0: ECmpTInt16, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TInt32. sl@0: */ sl@0: ECmpTInt32, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TInt. sl@0: */ sl@0: ECmpTInt, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TUint8. sl@0: */ sl@0: ECmpTUint8, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TUint16. sl@0: */ sl@0: ECmpTUint16, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TUint32. sl@0: */ sl@0: ECmpTUint32, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TUint. sl@0: */ sl@0: ECmpTUint, sl@0: sl@0: sl@0: /** sl@0: The key is assumed to be of type TInt64. sl@0: */ sl@0: ECmpTInt64 sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the characteristics of a key used to access the elements of an array. sl@0: sl@0: The class is abstract and cannot be instantiated. A derived class must be sl@0: defined and implemented. sl@0: sl@0: The classes TKeyArrayFix, TKeyArrayVar and TKeyArrayPak, derived from TKey, sl@0: are already supplied to implement keys for the fixed length element, variable sl@0: length element and packed arrays. sl@0: sl@0: A derived class would normally be written to define the characteristics of sl@0: a key for a non standard array. sl@0: sl@0: @see TKeyArrayFix sl@0: @see TKeyArrayVar sl@0: @see TKeyArrayPak sl@0: */ sl@0: class TKey sl@0: { sl@0: public: sl@0: inline void SetPtr(const TAny* aPtr); sl@0: IMPORT_C virtual TInt Compare(TInt aLeft,TInt aRight) const; sl@0: IMPORT_C virtual TAny* At(TInt anIndex) const; sl@0: protected: sl@0: IMPORT_C TKey(); sl@0: IMPORT_C TKey(TInt aOffset,TKeyCmpText aType); sl@0: IMPORT_C TKey(TInt aOffset,TKeyCmpText aType,TInt aLength); sl@0: IMPORT_C TKey(TInt aOffset,TKeyCmpNumeric aType); sl@0: protected: sl@0: TInt iKeyOffset; sl@0: TInt iKeyLength; sl@0: TInt iCmpType; sl@0: const TAny* iPtr; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the basic behaviour for swapping two elements of an array. sl@0: sl@0: The class is abstract. A derived class must be defined and implemented to sl@0: use the functionality. sl@0: sl@0: A derived class can define how to swap two elements of an array. In practice, sl@0: this means providing an implementation for the virtual function Swap(). sl@0: sl@0: To support this, the derived class is also likely to need a pointer to the sl@0: array itself and suitable constructors and/or other member functions to set sl@0: such a pointer. sl@0: */ sl@0: class TSwap sl@0: { sl@0: public: sl@0: IMPORT_C TSwap(); sl@0: IMPORT_C virtual void Swap(TInt aLeft,TInt aRight) const; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Folds a specified character and provides functions to fold additional sl@0: characters after construction of the object. sl@0: sl@0: Folding converts the character to a form which can be used in tolerant sl@0: comparisons without control over the operations performed. Tolerant comparisons sl@0: are those which ignore character differences like case and accents. sl@0: sl@0: Note that folding is locale-independent behaviour. It is also important to sl@0: note that there can be no guarantee that folding is in any way culturally sl@0: appropriate, and should not be used for matching characters in sl@0: natural language. sl@0: sl@0: @see User::Fold sl@0: */ sl@0: class TCharF : public TChar sl@0: { sl@0: public: sl@0: inline TCharF(TUint aChar); sl@0: inline TCharF(const TChar& aChar); sl@0: inline TCharF& operator=(TUint aChar); sl@0: inline TCharF& operator=(const TChar& aChar); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Converts a specified character to lower case and provides functions to convert sl@0: additional characters after construction of the object. sl@0: */ sl@0: class TCharLC : public TChar sl@0: { sl@0: public: sl@0: inline TCharLC(TUint aChar); sl@0: inline TCharLC(const TChar& aChar); sl@0: inline TCharLC& operator=(TUint aChar); sl@0: inline TCharLC& operator=(const TChar& aChar); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Converts a specified character to upper case and provides functions to convert sl@0: additional characters after construction of the object. sl@0: */ sl@0: class TCharUC : public TChar sl@0: { sl@0: public: sl@0: inline TCharUC(TUint aChar); sl@0: inline TCharUC(const TChar& aChar); sl@0: inline TCharUC& operator=(TUint aChar); sl@0: inline TCharUC& operator=(const TChar& aChar); sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the character representation of a real number type such sl@0: as a TReal or a TRealX. sl@0: sl@0: An object of this type is used by functions that convert real values to sl@0: character format, for example, the descriptor functions: sl@0: Num(), AppendNum() and Format(). sl@0: sl@0: There are three constructors for constructing a suitable object. sl@0: The data members of the class, however, are public and can be sl@0: explicitly set after construction. sl@0: */ sl@0: class TRealFormat sl@0: { sl@0: public: sl@0: IMPORT_C TRealFormat(); sl@0: IMPORT_C TRealFormat(TInt aWidth); sl@0: IMPORT_C TRealFormat(TInt aWidth,TInt aDecimalPlaces); sl@0: public: sl@0: /** sl@0: Governs the format of the character representation of the real number. sl@0: sl@0: This is set to one of the defined format types. sl@0: sl@0: One or more of the defined format flags can subsequently be ORed into this member. sl@0: sl@0: @see KRealFormatFixed sl@0: @see KRealFormatExponent sl@0: @see KRealFormatGeneral sl@0: @see KRealFormatNoExponent sl@0: @see KRealFormatCalculator sl@0: @see KExtraSpaceForSign sl@0: @see KAllowThreeDigitExp sl@0: @see KDoNotUseTriads sl@0: @see KGeneralLimit sl@0: @see KUseSigFigs sl@0: */ sl@0: TInt iType; sl@0: sl@0: sl@0: /** sl@0: Defines the maximum number of characters required to represent the number. sl@0: */ sl@0: TInt iWidth; sl@0: sl@0: sl@0: /** sl@0: Defines either the number of characters to be used to represent the decimal sl@0: portion of the number, or the maximum number of significant digits in sl@0: the character representation of the number. sl@0: sl@0: The interpretation depends on the chosen format as defined by iType. sl@0: sl@0: @see TRealFormat::iType sl@0: */ sl@0: TInt iPlaces; sl@0: sl@0: sl@0: /** sl@0: Defines the character to be used to separate the integer portion of sl@0: a number representation from its decimal portion. sl@0: sl@0: In general, the character used for this purpose is a matter of local sl@0: convention. The TLocale::DecimalSeparator() function can supply the sl@0: desired character. sl@0: sl@0: @see TLocale sl@0: */ sl@0: TChar iPoint; sl@0: sl@0: sl@0: /** sl@0: Defines the character to be used to delimit groups of three digits in sl@0: the integer part of the number. sl@0: sl@0: In general, the character used for this purpose is a matter of local sl@0: convention. The TLocale::ThousandsSeparator() function can supply the sl@0: desired character. sl@0: sl@0: @see TLocale sl@0: */ sl@0: TChar iTriad; sl@0: sl@0: sl@0: /** sl@0: Defines the threshold number of digits above which triad separation is to sl@0: occur. A value of zero disables triad separation and no triad separation sl@0: character (i.e. the character held in iTriad) is inserted into the sl@0: resulting character representation regardless of the number of characters. sl@0: sl@0: For example, a value of 1 causes the number 1000 to be represented by the sl@0: characters "1,000" whereas a value of 4 causes the same number to be sl@0: represented by the characters "1000" (This assumes the ‘,’ triad separation sl@0: character). sl@0: sl@0: Note that no triad separation occurs if the flag KDoNotUseTriads is set in sl@0: the iType data member. sl@0: sl@0: @see TRealFormat::iTriad sl@0: @see KDoNotUseTriads sl@0: */ sl@0: TInt iTriLen; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the extraction mark used by the TLex8 class to indicate the current sl@0: lexical element being analysed. sl@0: sl@0: In practice, objects of this type are accessed through the TLexMark typedef. sl@0: sl@0: @see TLexMark sl@0: @see TLex8 sl@0: */ sl@0: class TLexMark8 sl@0: { sl@0: public: sl@0: inline TLexMark8(); sl@0: private: sl@0: inline TLexMark8(const TUint8* aString); sl@0: const TUint8* iPtr; sl@0: friend class TLex8; sl@0: __DECLARE_TEST; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: class TRealX; sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Provides general string-parsing functions suitable for numeric format sl@0: conversions and syntactical-element parsing. sl@0: sl@0: The class is the 8-bit variant for non-Unicode strings and 8-bit wide sl@0: characters. sl@0: sl@0: An instance of this class stores a string, maintaining an extraction mark sl@0: to indicate the current lexical element being analysed and a pointer to the sl@0: next character to be examined. sl@0: sl@0: Objects of this type are normally accessed through the build independent type sl@0: TLex. sl@0: sl@0: @see TLex sl@0: */ sl@0: class TLex8 sl@0: { sl@0: public: sl@0: IMPORT_C TLex8(); sl@0: inline TLex8(const TUint8* aString); sl@0: inline TLex8(const TDesC8& aDes); sl@0: inline TLex8& operator=(const TUint8* aString); sl@0: inline TLex8& operator=(const TDesC8& aDes); sl@0: inline TBool Eos() const; sl@0: inline void Mark(TLexMark8& aMark) const; sl@0: inline void Mark(); sl@0: IMPORT_C void Inc(); sl@0: IMPORT_C void Inc(TInt aNumber); sl@0: IMPORT_C TChar Get(); sl@0: IMPORT_C TChar Peek() const; sl@0: IMPORT_C void UnGet(); sl@0: inline void UnGetToMark(); sl@0: IMPORT_C void UnGetToMark(const TLexMark8 aMark); sl@0: IMPORT_C void SkipSpace(); sl@0: inline void SkipAndMark(TInt aNumber); sl@0: IMPORT_C void SkipAndMark(TInt aNumber, TLexMark8& aMark); sl@0: inline void SkipSpaceAndMark(); sl@0: IMPORT_C void SkipSpaceAndMark(TLexMark8& aMark); sl@0: IMPORT_C void SkipCharacters(); sl@0: inline TInt TokenLength() const; sl@0: IMPORT_C TInt TokenLength(const TLexMark8 aMark) const; sl@0: IMPORT_C TPtrC8 MarkedToken() const; sl@0: IMPORT_C TPtrC8 MarkedToken(const TLexMark8 aMark) const; sl@0: IMPORT_C TPtrC8 NextToken(); sl@0: IMPORT_C TPtrC8 Remainder() const; sl@0: IMPORT_C TPtrC8 RemainderFromMark() const; sl@0: IMPORT_C TPtrC8 RemainderFromMark(const TLexMark8 aMark) const; sl@0: IMPORT_C TInt Offset() const; sl@0: inline TInt MarkedOffset() const; sl@0: IMPORT_C TInt MarkedOffset(const TLexMark8 aMark) const; sl@0: IMPORT_C TInt Val(TInt8& aVal); sl@0: IMPORT_C TInt Val(TInt16& aVal); sl@0: IMPORT_C TInt Val(TInt32& aVal); sl@0: IMPORT_C TInt Val(TInt64& aVal); sl@0: inline TInt Val(TInt& aVal); sl@0: IMPORT_C TInt Val(TUint8& aVal,TRadix aRadix); sl@0: IMPORT_C TInt Val(TUint16& aVal,TRadix aRadix); sl@0: IMPORT_C TInt Val(TUint32& aVal,TRadix aRadix); sl@0: IMPORT_C TInt Val(TInt64& aVal, TRadix aRadix); sl@0: inline TInt Val(TUint& aVal,TRadix aRadix=EDecimal); sl@0: IMPORT_C TInt BoundedVal(TInt32& aVal,TInt aLimit); sl@0: IMPORT_C TInt BoundedVal(TInt64& aVal, const TInt64& aLimit); sl@0: IMPORT_C TInt BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit); sl@0: IMPORT_C TInt BoundedVal(TInt64& aVal, TRadix aRadix, const TInt64& aLimit); sl@0: IMPORT_C TInt Val(TReal32& aVal); sl@0: IMPORT_C TInt Val(TReal32& aVal,TChar aPoint); sl@0: IMPORT_C TInt Val(TReal64& aVal); sl@0: IMPORT_C TInt Val(TReal64& aVal,TChar aPoint); sl@0: inline void Assign(const TLex8& aLex); sl@0: IMPORT_C void Assign(const TUint8* aString); sl@0: IMPORT_C void Assign(const TDesC8& aDes); sl@0: TInt Val(TRealX& aVal); sl@0: TInt Val(TRealX& aVal, TChar aPoint); sl@0: sl@0: /** @deprecated Use BoundedVal(TInt32& aVal,TInt aLimit) */ sl@0: inline TInt Val(TInt32& aVal,TInt aLimit) { return BoundedVal(aVal,aLimit); }; sl@0: sl@0: /** @deprecated Use BoundedVal(TInt64& aVal,const TInt64& aLimit) */ sl@0: inline TInt Val(TInt64& aVal,const TInt64& aLimit) { return BoundedVal(aVal,aLimit); }; sl@0: sl@0: /** @deprecated Use BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit) */ sl@0: inline TInt Val(TUint32& aVal,TRadix aRadix,TUint aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; sl@0: sl@0: /** @deprecated Use BoundedVal(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) */ sl@0: inline TInt Val(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; sl@0: private: sl@0: void Scndig(TInt& aSig, TInt& aExp, TUint64& aDl); sl@0: void ScndigAfterPoint(TInt& aSig, TUint64& aDl); sl@0: void ValidateMark(const TLexMark8 aMark) const; sl@0: private: sl@0: const TUint8* iNext; sl@0: const TUint8* iBuf; sl@0: const TUint8* iEnd; sl@0: TLexMark8 iMark; sl@0: __DECLARE_TEST; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the extraction mark used by the TLex16 class to indicate the current sl@0: lexical element being analysed. sl@0: sl@0: In practice, objects of this type are accessed through the TLexMark typedef. sl@0: sl@0: @see TLexMark sl@0: @see TLex16 sl@0: */ sl@0: class TLexMark16 sl@0: { sl@0: public: sl@0: inline TLexMark16(); sl@0: private: sl@0: inline TLexMark16(const TUint16* aString); sl@0: const TUint16* iPtr; sl@0: friend class TLex16; sl@0: __DECLARE_TEST; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Provides general string-parsing functions suitable for numeric format sl@0: conversions and syntactical-element parsing. sl@0: sl@0: The class is the 16-bit variant for Unicode strings and 16-bit wide sl@0: characters. sl@0: sl@0: An instance of this class stores a string, maintaining an extraction mark sl@0: to indicate the current lexical element being analysed and a pointer to the sl@0: next character to be examined. sl@0: sl@0: Objects of this type are normally accessed through the build independent type sl@0: TLex. sl@0: sl@0: @see TLex sl@0: */ sl@0: class TLex16 sl@0: { sl@0: public: sl@0: IMPORT_C TLex16(); sl@0: inline TLex16(const TUint16* aString); sl@0: inline TLex16(const TDesC16& aDes); sl@0: inline TLex16& operator=(const TUint16* aString); sl@0: inline TLex16& operator=(const TDesC16& aDes); sl@0: inline TBool Eos() const; sl@0: inline void Mark(); sl@0: inline void Mark(TLexMark16& aMark) const; sl@0: IMPORT_C void Inc(); sl@0: IMPORT_C void Inc(TInt aNumber); sl@0: IMPORT_C TChar Get(); sl@0: IMPORT_C TChar Peek() const; sl@0: IMPORT_C void UnGet(); sl@0: inline void UnGetToMark(); sl@0: IMPORT_C void UnGetToMark(const TLexMark16 aMark); sl@0: IMPORT_C void SkipSpace(); sl@0: inline void SkipAndMark(TInt aNumber); sl@0: IMPORT_C void SkipAndMark(TInt aNumber, TLexMark16& aMark); sl@0: IMPORT_C void SkipSpaceAndMark(TLexMark16& aMark); sl@0: inline void SkipSpaceAndMark(); sl@0: IMPORT_C void SkipCharacters(); sl@0: inline TInt TokenLength() const; sl@0: IMPORT_C TInt TokenLength(const TLexMark16 aMark) const; sl@0: IMPORT_C TPtrC16 MarkedToken() const; sl@0: IMPORT_C TPtrC16 MarkedToken(const TLexMark16 aMark) const; sl@0: IMPORT_C TPtrC16 NextToken(); sl@0: IMPORT_C TPtrC16 Remainder() const; sl@0: IMPORT_C TPtrC16 RemainderFromMark() const; sl@0: IMPORT_C TPtrC16 RemainderFromMark(const TLexMark16 aMark) const; sl@0: IMPORT_C TInt Offset() const; sl@0: inline TInt MarkedOffset() const; sl@0: IMPORT_C TInt MarkedOffset(const TLexMark16 aMark) const; sl@0: IMPORT_C TInt Val(TInt8& aVal); sl@0: IMPORT_C TInt Val(TInt16& aVal); sl@0: IMPORT_C TInt Val(TInt32& aVal); sl@0: IMPORT_C TInt Val(TInt64& aVal); sl@0: inline TInt Val(TInt& aVal); sl@0: IMPORT_C TInt Val(TUint8& aVal,TRadix aRadix); sl@0: IMPORT_C TInt Val(TUint16& aVal,TRadix aRadix); sl@0: IMPORT_C TInt Val(TUint32& aVal,TRadix aRadix); sl@0: IMPORT_C TInt Val(TInt64& aVal, TRadix aRadix); sl@0: // inline TInt Val(TInt64& aVal, TRadix aRadix) {return Val(aVal,aRadix);} sl@0: inline TInt Val(TUint& aVal,TRadix aRadix=EDecimal); sl@0: IMPORT_C TInt BoundedVal(TInt32& aVal,TInt aLimit); sl@0: IMPORT_C TInt BoundedVal(TInt64& aVal, const TInt64& aLimit); sl@0: IMPORT_C TInt BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit); sl@0: IMPORT_C TInt BoundedVal(TInt64& aVal, TRadix aRadix, const TInt64& aLimit); sl@0: IMPORT_C TInt Val(TReal32& aVal); sl@0: IMPORT_C TInt Val(TReal32& aVal,TChar aPoint); sl@0: IMPORT_C TInt Val(TReal64& aVal); sl@0: IMPORT_C TInt Val(TReal64& aVal,TChar aPoint); sl@0: inline void Assign(const TLex16& aLex); sl@0: IMPORT_C void Assign(const TUint16* aString); sl@0: IMPORT_C void Assign(const TDesC16& aDes); sl@0: TInt Val(TRealX& aVal); sl@0: TInt Val(TRealX& aVal, TChar aPoint); sl@0: sl@0: /** @deprecated Use BoundedVal(TInt32& aVal,TInt aLimit) */ sl@0: inline TInt Val(TInt32& aVal,TInt aLimit) { return BoundedVal(aVal,aLimit); }; sl@0: sl@0: /** @deprecated Use BoundedVal(TInt64& aVal,const TInt64& aLimit) */ sl@0: inline TInt Val(TInt64& aVal,const TInt64& aLimit) { return BoundedVal(aVal,aLimit); }; sl@0: sl@0: /** @deprecated Use BoundedVal(TUint32& aVal,TRadix aRadix,TUint aLimit) */ sl@0: inline TInt Val(TUint32& aVal,TRadix aRadix,TUint aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; sl@0: sl@0: /** @deprecated Use BoundedVal(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) */ sl@0: inline TInt Val(TInt64& aVal,TRadix aRadix,const TInt64& aLimit) { return BoundedVal(aVal,aRadix,aLimit); }; sl@0: private: sl@0: void Scndig(TInt& aSig, TInt& aExp, TUint64& aDl); sl@0: void ValidateMark(const TLexMark16 aMark) const; sl@0: private: sl@0: const TUint16* iNext; sl@0: const TUint16* iBuf; sl@0: const TUint16* iEnd; sl@0: TLexMark16 iMark; sl@0: __DECLARE_TEST; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: #if defined(_UNICODE) sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Provides access to general string-parsing functions suitable for numeric format sl@0: conversions and syntactical-element parsing. sl@0: sl@0: It maps directly to either a TLex16 for a Unicode build or a TLex8 for a non-Unicode sl@0: build. sl@0: sl@0: The build independent type should always be used unless an explicit 16 bit sl@0: or 8 bit build variant is required. sl@0: sl@0: @see TLex16 sl@0: @see TLex8 sl@0: */ sl@0: typedef TLex16 TLex; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the extraction mark used by the TLex classes to indicate the current sl@0: lexical element being analysed. sl@0: sl@0: It maps directly to either a TLexMark16 for a Unicode build or a TLexMark8 sl@0: for a non-Unicode build. sl@0: sl@0: The build independent type should always be used unless an explicit 16 bit sl@0: or 8 bit build variant is required. sl@0: */ sl@0: typedef TLexMark16 TLexMark; sl@0: sl@0: sl@0: sl@0: sl@0: #else sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Provides access to general string-parsing functions suitable for numeric format sl@0: conversions and syntactical-element parsing. sl@0: sl@0: It maps directly to either a TLex16 for a Unicode build or a TLex8 for a non-Unicode sl@0: build. sl@0: sl@0: The build independent type should always be used unless an explicit 16 bit sl@0: or 8 bit build variant is required. sl@0: sl@0: @see TLex16 sl@0: @see TLex8 sl@0: */ sl@0: typedef TLex8 TLex; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines the extraction mark used by the TLex classes to indicate the current sl@0: lexical element being analysed. sl@0: sl@0: It maps directly to either a TLexMark16 for a Unicode build or a TLexMark8 sl@0: for a non-Unicode build. sl@0: sl@0: The build independent type should always be used unless an explicit 16 bit sl@0: or 8 bit build variant is required. sl@0: */ sl@0: typedef TLexMark8 TLexMark; sl@0: #endif sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Packages a Uid type together with a checksum. sl@0: sl@0: @see TUidType sl@0: */ sl@0: class TCheckedUid sl@0: { sl@0: public: sl@0: IMPORT_C TCheckedUid(); sl@0: IMPORT_C TCheckedUid(const TUidType& aUidType); sl@0: IMPORT_C TCheckedUid(const TDesC8& aPtr); sl@0: IMPORT_C void Set(const TUidType& aUidType); sl@0: IMPORT_C void Set(const TDesC8& aPtr); sl@0: IMPORT_C TPtrC8 Des() const; sl@0: inline const TUidType& UidType() const; sl@0: protected: sl@0: IMPORT_C TUint Check() const; sl@0: private: sl@0: TUidType iType; sl@0: TUint iCheck; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A date and time object in which the individual components are accessible in sl@0: human-readable form. sl@0: sl@0: The individual components are: year, month, day, hour, minute, sl@0: second and microsecond. sl@0: sl@0: These components are stored as integers and all except the year are checked for sl@0: validity when a TDateTime is constructed or assigned new values. sl@0: sl@0: This class only supports getting and setting the entire date/time or any component sl@0: of it. It does not support adding or subtracting intervals to or from a time. sl@0: For functions which manipulate times, use class TTime. sl@0: sl@0: @see TTime sl@0: */ sl@0: class TDateTime sl@0: { sl@0: public: sl@0: inline TDateTime(); sl@0: IMPORT_C TDateTime(TInt aYear,TMonth aMonth,TInt aDay,TInt aHour,TInt aMinute, TInt aSecond,TInt aMicroSecond); sl@0: IMPORT_C TInt Set(TInt aYear,TMonth aMonth,TInt aDay,TInt aHour,TInt aMinute, TInt aSecond,TInt aMicroSecond); sl@0: IMPORT_C TInt SetYear(TInt aYear); sl@0: IMPORT_C TInt SetYearLeapCheck(TInt aYear); sl@0: IMPORT_C TInt SetMonth(TMonth aMonth); sl@0: IMPORT_C TInt SetDay(TInt aDay); sl@0: IMPORT_C TInt SetHour(TInt aHour); sl@0: IMPORT_C TInt SetMinute(TInt aMinute); sl@0: IMPORT_C TInt SetSecond(TInt aSecond); sl@0: IMPORT_C TInt SetMicroSecond(TInt aMicroSecond); sl@0: inline TInt Year() const; sl@0: inline TMonth Month() const; sl@0: inline TInt Day() const; sl@0: inline TInt Hour() const; sl@0: inline TInt Minute() const; sl@0: inline TInt Second() const; sl@0: inline TInt MicroSecond() const; sl@0: private: sl@0: TInt iYear; sl@0: TMonth iMonth; sl@0: TInt iDay; sl@0: TInt iHour; sl@0: TInt iMinute; sl@0: TInt iSecond; sl@0: TInt iMicroSecond; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval of a millionth of a second stored as sl@0: a 64-bit integer. sl@0: sl@0: It supports the initialisation, setting and getting of an interval and provides sl@0: standard comparison operations. Objects of this class can be added to and sl@0: subtracted from TTime objects. sl@0: sl@0: @see TTime sl@0: */ sl@0: class TTimeIntervalMicroSeconds sl@0: { sl@0: public: sl@0: inline TTimeIntervalMicroSeconds(); sl@0: inline TTimeIntervalMicroSeconds(const TInt64& aInterval); sl@0: inline TTimeIntervalMicroSeconds& operator=(const TInt64& aInterval); sl@0: inline TBool operator==(const TTimeIntervalMicroSeconds& aInterval) const; sl@0: inline TBool operator!=(const TTimeIntervalMicroSeconds& aInterval) const; sl@0: inline TBool operator>=(const TTimeIntervalMicroSeconds& aInterval) const; sl@0: inline TBool operator<=(const TTimeIntervalMicroSeconds& aInterval) const; sl@0: inline TBool operator>(const TTimeIntervalMicroSeconds& aInterval) const; sl@0: inline TBool operator<(const TTimeIntervalMicroSeconds& aInterval) const; sl@0: inline const TInt64& Int64() const; sl@0: private: sl@0: TInt64 iInterval; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Provides a base class for all time interval classes using sl@0: a 32-bit representation. sl@0: sl@0: It supports retrieving the interval and provides various operations for sl@0: comparing intervals. Its concrete derived classes can be added to and sl@0: subtracted from a TTime. sl@0: sl@0: The comparison operators simply compare the integer representations of the sl@0: two intervals. They do not take account of different time interval units. sl@0: So, for example, when comparing for equality an interval of three hours with sl@0: an interval of three days, the result is true. sl@0: sl@0: @see TTime sl@0: */ sl@0: class TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TBool operator==(TTimeIntervalBase aInterval) const; sl@0: inline TBool operator!=(TTimeIntervalBase aInterval) const; sl@0: inline TBool operator>=(TTimeIntervalBase aInterval) const; sl@0: inline TBool operator<=(TTimeIntervalBase aInterval) const; sl@0: inline TBool operator>(TTimeIntervalBase aInterval) const; sl@0: inline TBool operator<(TTimeIntervalBase aInterval) const; sl@0: inline TInt Int() const; sl@0: protected: sl@0: inline TTimeIntervalBase(); sl@0: inline TTimeIntervalBase(TInt aInterval); sl@0: protected: sl@0: TInt iInterval; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a microsecond time interval stored in 32 rather than 64 bits. sl@0: sl@0: Its range is +-2147483647, which is +-35 minutes, 47 seconds. Comparison and sl@0: interval retrieval functions are provided by the base class TTimeIntervalBase. sl@0: */ sl@0: class TTimeIntervalMicroSeconds32 : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalMicroSeconds32(); sl@0: inline TTimeIntervalMicroSeconds32(TInt aInterval); sl@0: inline TTimeIntervalMicroSeconds32& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval in seconds. sl@0: sl@0: Comparison and interval retrieval functions sl@0: are provided by the base class TTimeIntervalBase. sl@0: sl@0: The range of values which it can represent is +-2147483647, which is equal to sl@0: +-24855 days (approximately 68 years). sl@0: */ sl@0: class TTimeIntervalSeconds : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalSeconds(); sl@0: inline TTimeIntervalSeconds(TInt aInterval); sl@0: inline TTimeIntervalSeconds& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval in minutes. sl@0: sl@0: Comparison and interval retrieval functions sl@0: are provided by the base class TTimeIntervalBase. sl@0: */ sl@0: class TTimeIntervalMinutes : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalMinutes(); sl@0: inline TTimeIntervalMinutes(TInt aInterval); sl@0: inline TTimeIntervalMinutes& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval in hours. sl@0: sl@0: Comparison and interval retrieval functions sl@0: are provided by the base class TTimeIntervalBase. sl@0: */ sl@0: class TTimeIntervalHours : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalHours(); sl@0: inline TTimeIntervalHours(TInt aInterval); sl@0: inline TTimeIntervalHours& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval in days. sl@0: sl@0: Comparison and interval retrieval functions sl@0: are provided by the base class TTimeIntervalBase. sl@0: */ sl@0: class TTimeIntervalDays : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalDays(); sl@0: inline TTimeIntervalDays(TInt aInterval); sl@0: inline TTimeIntervalDays& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval in months. sl@0: sl@0: Comparison and interval retrieval functions sl@0: are provided by the base class TTimeIntervalBase. sl@0: */ sl@0: class TTimeIntervalMonths : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalMonths(); sl@0: inline TTimeIntervalMonths(TInt aInterval); sl@0: inline TTimeIntervalMonths& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Represents a time interval in years. sl@0: sl@0: Comparison and interval retrieval functions sl@0: are provided by the base class TTimeIntervalBase. sl@0: */ sl@0: class TTimeIntervalYears : public TTimeIntervalBase sl@0: { sl@0: public: sl@0: inline TTimeIntervalYears(); sl@0: inline TTimeIntervalYears(TInt aInterval); sl@0: inline TTimeIntervalYears& operator=(TInt aInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: An enumeration one or both of whose enumerator values may be returned sl@0: by TTime::Parse(). sl@0: sl@0: @see TTime::Parse sl@0: */ sl@0: enum { sl@0: /** sl@0: Indicates that a time is present. sl@0: sl@0: @see TTime::Parse sl@0: */ sl@0: EParseTimePresent=0x1, sl@0: /** sl@0: Indicates that a date is present. sl@0: sl@0: @see TTime::Parse sl@0: */ sl@0: EParseDatePresent=0x2 sl@0: }; sl@0: sl@0: sl@0: sl@0: class TLocale; sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Stores and manipulates the date and time. sl@0: sl@0: It represents a date and time as a number of microseconds since midnight, sl@0: January 1st, 1 AD nominal Gregorian. BC dates are represented by negative sl@0: TTime values. A TTime object may be constructed from a TInt64, a TDateTime sl@0: a string literal, or by default, which initialises the time to an arbitrary sl@0: value. To access human-readable time information, the TTime may be converted sl@0: from a TInt64 into a TDateTime, which represents the date and time as seven sl@0: numeric fields and provides functions to extract these fields. Alternatively, sl@0: to display the time as text, the time may be formatted and placed into a sl@0: descriptor using a variety of formatting commands and which may or may not sl@0: honour the system's locale settings. The conversion between time and text may sl@0: be performed the other way around, so that a descriptor can be parsed and sl@0: converted into a TTime value. sl@0: sl@0: In addition to setting and getting the date and time and converting between sl@0: text and time, TTime provides functions to get intervals between times and sl@0: standard comparison and arithmetic operators which enable time intervals to sl@0: be added or subtracted to or from the time. sl@0: sl@0: @see TInt64 sl@0: @see TDateTime sl@0: */ sl@0: class TTime sl@0: { sl@0: public: sl@0: inline TTime(); sl@0: inline TTime(const TInt64& aTime); sl@0: IMPORT_C TTime(const TDesC& aString); sl@0: IMPORT_C TTime(const TDateTime& aDateTime); sl@0: inline TTime& operator=(const TInt64& aTime); sl@0: IMPORT_C TTime& operator=(const TDateTime& aDateTime); sl@0: IMPORT_C void HomeTime(); sl@0: IMPORT_C void UniversalTime(); sl@0: IMPORT_C TInt Set(const TDesC& aString); sl@0: IMPORT_C TInt HomeTimeSecure(); sl@0: IMPORT_C TInt UniversalTimeSecure(); sl@0: sl@0: IMPORT_C TDateTime DateTime() const; sl@0: IMPORT_C TTimeIntervalMicroSeconds MicroSecondsFrom(TTime aTime) const; sl@0: IMPORT_C TInt SecondsFrom(TTime aTime,TTimeIntervalSeconds& aInterval) const; sl@0: IMPORT_C TInt MinutesFrom(TTime aTime,TTimeIntervalMinutes& aInterval) const; sl@0: IMPORT_C TInt HoursFrom(TTime aTime,TTimeIntervalHours& aInterval) const; sl@0: IMPORT_C TTimeIntervalDays DaysFrom(TTime aTime) const; sl@0: IMPORT_C TTimeIntervalMonths MonthsFrom(TTime aTime) const; sl@0: IMPORT_C TTimeIntervalYears YearsFrom(TTime aTime) const; sl@0: sl@0: IMPORT_C TInt DaysInMonth() const; sl@0: IMPORT_C TDay DayNoInWeek() const; sl@0: IMPORT_C TInt DayNoInMonth() const; sl@0: IMPORT_C TInt DayNoInYear() const; sl@0: IMPORT_C TInt DayNoInYear(TTime aStartDate) const; sl@0: IMPORT_C TInt WeekNoInYear() const; sl@0: IMPORT_C TInt WeekNoInYear(TTime aStartDate) const; sl@0: IMPORT_C TInt WeekNoInYear(TFirstWeekRule aRule) const; sl@0: IMPORT_C TInt WeekNoInYear(TTime aStartDate,TFirstWeekRule aRule) const; sl@0: IMPORT_C void FormatL(TDes& aDes,const TDesC& aFormat) const; sl@0: IMPORT_C void FormatL(TDes& aDes,const TDesC& aFormat,const TLocale& aLocale) const; sl@0: IMPORT_C void RoundUpToNextMinute(); sl@0: IMPORT_C TInt Parse(const TDesC& aDes,TInt aCenturyOffset=0); sl@0: sl@0: IMPORT_C TTime operator+(TTimeIntervalYears aYear) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalMonths aMonth) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalDays aDay) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalHours aHour) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalMinutes aMinute) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalSeconds aSecond) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalMicroSeconds aMicroSecond) const; sl@0: IMPORT_C TTime operator+(TTimeIntervalMicroSeconds32 aMicroSecond) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalYears aYear) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalMonths aMonth) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalDays aDay) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalHours aHour) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalMinutes aMinute) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalSeconds aSecond) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalMicroSeconds aMicroSecond) const; sl@0: IMPORT_C TTime operator-(TTimeIntervalMicroSeconds32 aMicroSecond) const; sl@0: IMPORT_C TTime& operator+=(TTimeIntervalYears aYear); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalMonths aMonth); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalDays aDay); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalHours aHour); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalMinutes aMinute); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalSeconds aSecond); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalMicroSeconds aMicroSecond); sl@0: IMPORT_C TTime& operator+=(TTimeIntervalMicroSeconds32 aMicroSecond); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalYears aYear); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalMonths aMonth); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalDays aDay); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalHours aHour); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalMinutes aMinute); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalSeconds aSecond); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalMicroSeconds aMicroSecond); sl@0: IMPORT_C TTime& operator-=(TTimeIntervalMicroSeconds32 aMicroSecond); sl@0: inline TBool operator==(TTime aTime) const; sl@0: inline TBool operator!=(TTime aTime) const; sl@0: inline TBool operator>=(TTime aTime) const; sl@0: inline TBool operator<=(TTime aTime) const; sl@0: inline TBool operator>(TTime aTime) const; sl@0: inline TBool operator<(TTime aTime) const; sl@0: inline const TInt64& Int64() const; sl@0: private: sl@0: static TTime Convert(const TDateTime& aDateTime); sl@0: private: sl@0: TInt64 iTime; sl@0: __DECLARE_TEST; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A utility class whose functions may be used by the other date/time related sl@0: classes. sl@0: */ sl@0: class Time sl@0: { sl@0: public: sl@0: IMPORT_C static TTime NullTTime(); sl@0: IMPORT_C static TTime MaxTTime(); sl@0: IMPORT_C static TTime MinTTime(); sl@0: IMPORT_C static TInt DaysInMonth(TInt aYear, TMonth aMonth); sl@0: IMPORT_C static TBool IsLeapYear(TInt aYear); sl@0: IMPORT_C static TInt LeapYearsUpTo(TInt aYear); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Gets a copy of the current locale's full text name for a day of the week. sl@0: sl@0: After construction or after a call to Set(), the copy of the text can be accessed sl@0: and manipulated using the standard descriptor member functions provided by sl@0: the base class. sl@0: sl@0: @see KMaxDayName sl@0: */ sl@0: class TDayName : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TDayName(); sl@0: IMPORT_C TDayName(TDay aDay); sl@0: IMPORT_C void Set(TDay aDay); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Gets a copy of the current locale's abbreviated text name for a day of the sl@0: week. sl@0: sl@0: After construction or after a call to Set(), the copy of the abbreviated text sl@0: can be accessed and manipulated using the standard descriptor member functions sl@0: provided by the base class. sl@0: sl@0: The abbreviated day name cannot be assumed to be one character. In English, sl@0: it is 3 characters (Mon, Tue, Wed etc.), but the length can vary from locale sl@0: to locale, with a maximum length of KMaxDayNameAbb. sl@0: sl@0: @see KMaxDayNameAbb sl@0: */ sl@0: class TDayNameAbb : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TDayNameAbb(); sl@0: IMPORT_C TDayNameAbb(TDay aDay); sl@0: IMPORT_C void Set(TDay aDay); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Gets a copy of the current locale's full text name for a month. sl@0: sl@0: After construction or after a call to Set(), the copy of the text can be accessed sl@0: and manipulated using the standard descriptor member functions provided by sl@0: the base class. sl@0: sl@0: @see KMaxMonthName sl@0: */ sl@0: class TMonthName : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TMonthName(); sl@0: IMPORT_C TMonthName(TMonth aMonth); sl@0: IMPORT_C void Set(TMonth aMonth); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Gets a copy of the current locale's abbreviated text name for a month. sl@0: sl@0: After construction or after a call to Set(), the copy of the abbreviated text sl@0: can be accessed and manipulated using the standard descriptor member functions sl@0: provided by the base class. sl@0: sl@0: @see KMaxMonthNameAbb sl@0: */ sl@0: class TMonthNameAbb : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TMonthNameAbb(); sl@0: IMPORT_C TMonthNameAbb(TMonth aMonth); sl@0: IMPORT_C void Set(TMonth aMonth); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Gets a copy of the current locale's date suffix text for a specific day in sl@0: the month. sl@0: sl@0: The text is the set of characters which can be appended to dates of the month sl@0: (e.g. in English, st for 1st, nd for 2nd etc). sl@0: sl@0: After construction or after a call to Set(), the copy of the suffix text can sl@0: be accessed and manipulated using the standard descriptor member functions sl@0: provided by the base class. sl@0: */ sl@0: class TDateSuffix : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TDateSuffix(); sl@0: IMPORT_C TDateSuffix(TInt aDateSuffix); sl@0: IMPORT_C void Set(TInt aDateSuffix); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Current locale's am/pm text sl@0: sl@0: This class retrieves a copy of the current locale's text identifying time sl@0: before and after noon. In English, this is am and pm. sl@0: sl@0: After construction or after a call to Set(), the copy of the text can be accessed sl@0: and manipulated using the standard descriptor member functions provided by sl@0: the base class. sl@0: */ sl@0: class TAmPmName : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TAmPmName(); sl@0: IMPORT_C TAmPmName(TAmPm aSelector); sl@0: IMPORT_C void Set(TAmPm aSelector); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Gets a copy of the currency symbol(s) in use by the current locale. sl@0: sl@0: After construction or after a call to TCurrencySymbol::Set(), the copy of sl@0: the currency symbol(s) can be accessed and manipulated using the standard sl@0: descriptor member functions provided by the base class. sl@0: */ sl@0: class TCurrencySymbol : public TBuf sl@0: { sl@0: public: sl@0: IMPORT_C TCurrencySymbol(); sl@0: IMPORT_C void Set(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Contains a format list that defines the short date format. sl@0: sl@0: An instance of this class should be passed as the second argument sl@0: to TTime::FormatL(). sl@0: The string does not include any time components. The content of the long sl@0: date format specification is taken from the system-wide settings. sl@0: sl@0: For example, in the English locale, the short date format would be something sl@0: like 14/1/2000. sl@0: sl@0: This class is used as follows: sl@0: sl@0: @code sl@0: TTime now; sl@0: now.HomeTime(); sl@0: TBuf buffer; sl@0: now.FormatL(buffer,TShortDateFormatSpec()); sl@0: @endcode sl@0: sl@0: @see KMaxShortDateFormatSpec sl@0: @see TTime::FormatL sl@0: */ sl@0: class TShortDateFormatSpec : public TBuf // to be passed into TTime::FormatL sl@0: { sl@0: public: sl@0: IMPORT_C TShortDateFormatSpec(); sl@0: IMPORT_C void Set(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Contains a format list that defines the long date format. sl@0: sl@0: An instance of this class should be passed as the second argument sl@0: to TTime::FormatL(). sl@0: The string does not include any time components. The content of the long sl@0: date format specification is taken from the system-wide settings. sl@0: sl@0: For example, in the English locale, the long date format would be sl@0: something like 14th January 2000. sl@0: sl@0: This class is used as follows: sl@0: sl@0: @code sl@0: TTime now; sl@0: now.HomeTime(); sl@0: TBuf buffer; sl@0: now.FormatL(buffer,TLongDateFormatSpec()); sl@0: @endcode sl@0: sl@0: @see KMaxLongDateFormatSpec sl@0: @see TTime::FormatL sl@0: */ sl@0: class TLongDateFormatSpec : public TBuf // to be passed into TTime::FormatL sl@0: { sl@0: public: sl@0: IMPORT_C TLongDateFormatSpec(); sl@0: IMPORT_C void Set(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Contains a format list that defines the time string format. sl@0: sl@0: An instance of this class should be passed as the second argument sl@0: to TTime::FormatL(). sl@0: The string does not include any time components. The content of the time format sl@0: specification is taken from the system-wide settings. sl@0: sl@0: This class is used as follows: sl@0: sl@0: @code sl@0: TTime now; sl@0: now.HomeTime(); sl@0: TBuf buffer; sl@0: now.FormatL(buffer,TTimeFormatSpec()); sl@0: @endcode sl@0: sl@0: @see KMaxTimeFormatSpec sl@0: @see TTime::FormatL sl@0: */ sl@0: class TTimeFormatSpec : public TBuf // to be passed into TTime::FormatL sl@0: { sl@0: public: sl@0: IMPORT_C TTimeFormatSpec(); sl@0: IMPORT_C void Set(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Sets and gets the system's locale settings. sl@0: sl@0: Symbian OS maintains the locale information internally. On sl@0: construction, this object is initialized with the system information sl@0: for all locale items. sl@0: */ sl@0: class TLocale sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Indicates how negative currency values are formatted. sl@0: */ sl@0: enum TNegativeCurrencyFormat sl@0: { sl@0: /** sl@0: A minus sign is inserted before the currency symbol and value. sl@0: */ sl@0: ELeadingMinusSign, sl@0: sl@0: /** sl@0: The currency value and symbol are enclosed in brackets (no minus sign sl@0: is used). sl@0: */ sl@0: EInBrackets, //this one must be non-zero for binary compatibility with the old TBool TLocale::iCurrencyNegativeInBrackets which was exposed in the binary interface because it was accessed via *inline* functions sl@0: sl@0: /** sl@0: A minus sign is inserted after the currency symbol and value. sl@0: */ sl@0: ETrailingMinusSign, sl@0: sl@0: /** sl@0: A minus sign is inserted between the currency symbol and the value. sl@0: */ sl@0: EInterveningMinusSign sl@0: }; sl@0: sl@0: /** sl@0: Flags for negative currency values formatting sl@0: */ sl@0: enum sl@0: { sl@0: /** sl@0: If this flag is set and the currency value being formatted is negative, sl@0: if there is a space between the currency symbol and the value, sl@0: that space is lost. sl@0: */ sl@0: EFlagNegativeLoseSpace = 0x00000001, sl@0: sl@0: /** sl@0: If this flag is set and the currency value being formatted is negative, sl@0: the position of the currency symbol is placed in the opposite direction sl@0: from the position set for the positive currency value. sl@0: */ sl@0: EFlagNegativeCurrencySymbolOpposite=0x00000002 sl@0: }; sl@0: /** Indicates how the device universal time is maintained */ sl@0: enum TDeviceTimeState sl@0: { sl@0: /** Universal time is maintained by the device RTC and the user selection sl@0: of the locale of the device indicating offset from GMT and daylight saving*/ sl@0: EDeviceUserTime, sl@0: sl@0: /** Universal time and offset from GMT is supplied by the mobile network sl@0: and maintained by device RTC */ sl@0: ENITZNetworkTimeSync sl@0: }; sl@0: public: sl@0: IMPORT_C TLocale(); sl@0: inline TLocale(TInt); sl@0: IMPORT_C void Refresh(); sl@0: IMPORT_C TInt Set() const; sl@0: IMPORT_C void FormatCurrency(TDes& aText, TInt aAmount); sl@0: IMPORT_C void FormatCurrency(TDes& aText, TInt64 aAmount); sl@0: IMPORT_C void FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt aAmount); sl@0: IMPORT_C void FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt64 aAmount); sl@0: sl@0: inline TInt CountryCode() const; sl@0: inline void SetCountryCode(TInt aCode); sl@0: inline TTimeIntervalSeconds UniversalTimeOffset() const; sl@0: inline TDateFormat DateFormat() const; sl@0: inline void SetDateFormat(TDateFormat aFormat); sl@0: inline TTimeFormat TimeFormat() const; sl@0: inline void SetTimeFormat(TTimeFormat aFormat); sl@0: inline TLocalePos CurrencySymbolPosition() const; sl@0: inline void SetCurrencySymbolPosition(TLocalePos aPos); sl@0: inline TBool CurrencySpaceBetween() const; sl@0: inline void SetCurrencySpaceBetween(TBool aSpace); sl@0: inline TInt CurrencyDecimalPlaces() const; sl@0: inline void SetCurrencyDecimalPlaces(TInt aPlaces); sl@0: inline TBool CurrencyNegativeInBrackets() const; // These two functions are deprecated sl@0: inline void SetCurrencyNegativeInBrackets(TBool aBool); // They are here to maintain compatibility. Use the New functions -> NegativeCurrencyFormat setter/getter. sl@0: inline TBool CurrencyTriadsAllowed() const; sl@0: inline void SetCurrencyTriadsAllowed(TBool aBool); sl@0: inline TChar ThousandsSeparator() const; sl@0: inline void SetThousandsSeparator(const TChar& aChar); sl@0: inline TChar DecimalSeparator() const; sl@0: inline void SetDecimalSeparator(const TChar& aChar); sl@0: inline TChar DateSeparator(TInt aIndex) const; sl@0: inline void SetDateSeparator(const TChar& aChar,TInt aIndex); sl@0: inline TChar TimeSeparator(TInt aIndex) const; sl@0: inline void SetTimeSeparator(const TChar& aChar,TInt aIndex); sl@0: inline TBool AmPmSpaceBetween() const; sl@0: inline void SetAmPmSpaceBetween(TBool aSpace); sl@0: inline TLocalePos AmPmSymbolPosition() const; sl@0: inline void SetAmPmSymbolPosition(TLocalePos aPos); sl@0: inline TUint DaylightSaving() const; sl@0: inline TBool QueryHomeHasDaylightSavingOn() const; sl@0: inline TDaylightSavingZone HomeDaylightSavingZone() const; sl@0: inline TUint WorkDays() const; sl@0: inline void SetWorkDays(TUint aMask); sl@0: inline TDay StartOfWeek() const; sl@0: inline void SetStartOfWeek(TDay aDay); sl@0: inline TClockFormat ClockFormat() const; sl@0: inline void SetClockFormat(TClockFormat aFormat); sl@0: inline TUnitsFormat UnitsGeneral() const; sl@0: inline void SetUnitsGeneral(TUnitsFormat aFormat); sl@0: inline TUnitsFormat UnitsDistanceShort() const; sl@0: inline void SetUnitsDistanceShort(TUnitsFormat aFormat); sl@0: inline TUnitsFormat UnitsDistanceLong() const; sl@0: inline void SetUnitsDistanceLong(TUnitsFormat aFormat); sl@0: inline TNegativeCurrencyFormat NegativeCurrencyFormat() const; sl@0: inline void SetNegativeCurrencyFormat(TNegativeCurrencyFormat aNegativeCurrencyFormat); sl@0: inline TBool NegativeLoseSpace() const; sl@0: inline void SetNegativeLoseSpace(TBool aBool); sl@0: inline TBool NegativeCurrencySymbolOpposite() const; sl@0: inline void SetNegativeCurrencySymbolOpposite(TBool aBool); sl@0: inline TLanguage LanguageDowngrade(TInt aIndex) const; // 0 <= aIndex < 3 sl@0: inline void SetLanguageDowngrade(TInt aIndex, TLanguage aLanguage); sl@0: inline TDigitType DigitType() const; sl@0: inline void SetDigitType(TDigitType aDigitType); sl@0: inline TDeviceTimeState DeviceTime() const; sl@0: inline void SetDeviceTime(TDeviceTimeState aState); sl@0: inline TInt RegionCode() const; sl@0: sl@0: void SetDefaults(); /**< @internalComponent */ sl@0: sl@0: private: sl@0: friend class TExtendedLocale; sl@0: private: sl@0: TInt iCountryCode; sl@0: TTimeIntervalSeconds iUniversalTimeOffset; sl@0: TDateFormat iDateFormat; sl@0: TTimeFormat iTimeFormat; sl@0: TLocalePos iCurrencySymbolPosition; sl@0: TBool iCurrencySpaceBetween; sl@0: TInt iCurrencyDecimalPlaces; sl@0: TNegativeCurrencyFormat iNegativeCurrencyFormat; // replaced TBool iCurrencyNegativeInBrackets sl@0: TBool iCurrencyTriadsAllowed; sl@0: TChar iThousandsSeparator; sl@0: TChar iDecimalSeparator; sl@0: TChar iDateSeparator[KMaxDateSeparators]; sl@0: TChar iTimeSeparator[KMaxTimeSeparators]; sl@0: TLocalePos iAmPmSymbolPosition; sl@0: TBool iAmPmSpaceBetween; sl@0: TUint iDaylightSaving; sl@0: TDaylightSavingZone iHomeDaylightSavingZone; sl@0: TUint iWorkDays; sl@0: TDay iStartOfWeek; sl@0: TClockFormat iClockFormat; sl@0: TUnitsFormat iUnitsGeneral; sl@0: TUnitsFormat iUnitsDistanceShort; sl@0: TUnitsFormat iUnitsDistanceLong; sl@0: TUint iExtraNegativeCurrencyFormatFlags; sl@0: TUint16 iLanguageDowngrade[3]; sl@0: TUint16 iRegionCode; sl@0: TDigitType iDigitType; sl@0: TDeviceTimeState iDeviceTimeState; sl@0: TInt iSpare[0x1E]; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: TLocaleAspect sl@0: sl@0: Enumeration used with TExtendedLocale::LoadLocaleAspect to select which sl@0: locale information is to be replaced from the contents of the Locale sl@0: DLL being loaded. sl@0: sl@0: ELocaleLanguageSettings - Replaces everything that should change with sl@0: language selection e.g. Month names, Day names, sl@0: etc, sl@0: sl@0: ELocaleLocaleSettings - Replaces the currently selected currency symbol, sl@0: TLocale settings, and FAT utility functions sl@0: sl@0: ELocaleTimeAndDateSettings - Replaces the current time and date display sl@0: format settings. sl@0: sl@0: ELocaleCollateSettings - Replaces the "system" preferred Charset sl@0: (because that's where the collation table sl@0: is!). The "Default" charset will remain sl@0: unchanged until after the next power sl@0: off/on cycle sl@0: */ sl@0: enum TLocaleAspect sl@0: { sl@0: ELocaleLanguageSettings = 0x01, sl@0: ELocaleCollateSetting = 0x02, sl@0: ELocaleLocaleSettings = 0x04, sl@0: ELocaleTimeDateSettings = 0x08, sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: struct SLocaleLanguage sl@0: { sl@0: TLanguage iLanguage; sl@0: const TText* iDateSuffixTable; sl@0: const TText* iDayTable; sl@0: const TText* iDayAbbTable; sl@0: const TText* iMonthTable; sl@0: const TText* iMonthAbbTable; sl@0: const TText* iAmPmTable; sl@0: const TText16* const* iMsgTable; sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: struct SLocaleLocaleSettings sl@0: { sl@0: TText iCurrencySymbol[KMaxCurrencySymbol+1]; sl@0: TAny* iLocaleExtraSettingsDllPtr; sl@0: }; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: struct SLocaleTimeDateFormat sl@0: { sl@0: TText iShortDateFormatSpec[KMaxShortDateFormatSpec+1]; sl@0: TText iLongDateFormatSpec[KMaxLongDateFormatSpec+1]; sl@0: TText iTimeFormatSpec[KMaxTimeFormatSpec+1]; sl@0: TAny* iLocaleTimeDateFormatDllPtr; sl@0: }; sl@0: sl@0: struct LCharSet; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Extended locale class sl@0: sl@0: This class holds a collection of locale information. It contains a TLocale internally. sl@0: It has methods to load a locale DLL and to set the system wide locale information. sl@0: sl@0: */ sl@0: class TExtendedLocale sl@0: { sl@0: public: sl@0: sl@0: // Default constructor, create an empty instance sl@0: IMPORT_C TExtendedLocale(); sl@0: sl@0: // Initialise to (or restore from!) current system wide locale sl@0: // settings sl@0: IMPORT_C void LoadSystemSettings(); sl@0: sl@0: // Overwrite current system wide locale settings with the current sl@0: // contents of this TExtendedLocale sl@0: IMPORT_C TInt SaveSystemSettings(); sl@0: sl@0: //load a complete locale data from a single locale dll sl@0: IMPORT_C TInt LoadLocale(const TDesC& aLocaleDllName); sl@0: sl@0: //load a complete locale data from three locale dlls, which are language lcoale dll, region locale dll, and collation locale dll. sl@0: IMPORT_C TInt LoadLocale(const TDesC& aLanguageLocaleDllName, const TDesC& aRegionLocaleDllName, const TDesC& aCollationLocaleDllName); sl@0: sl@0: // Load an additional Locale DLL and over-ride a selected subset sl@0: // (currently ELocaleLanguageSettings to select an alternative set sl@0: // of language specific text strings, ELocaleCollateSetting to sl@0: // select a new system collation table, sl@0: // ELocaleOverRideMatchCollationTable to locally select an sl@0: // alternative collation order for matching text strings, or sl@0: // ELocaleOverRideSortCollationTable for ordering text strings) sl@0: // of settings with its contents sl@0: IMPORT_C TInt LoadLocaleAspect(TUint aAspectGroup, const TDesC& aLocaleDllName); sl@0: sl@0: //load a locale aspect from a locale dll. sl@0: //Such as load language locale aspect from locale language dll; sl@0: //load region locale aspect from locale region dll; sl@0: //load collation locale aspect from locale collation dll. sl@0: //There are in all three aspect, which are langauge, region, and collation. sl@0: IMPORT_C TInt LoadLocaleAspect(const TDesC& aLocaleDllName); sl@0: sl@0: // Set the currency Symbol sl@0: IMPORT_C TInt SetCurrencySymbol(const TDesC &aSymbol); sl@0: sl@0: // Get the name of the DLL holding the data for a particular set sl@0: // of Locale properties sl@0: IMPORT_C TInt GetLocaleDllName(TLocaleAspect aLocaleDataSet, TDes& aDllName); sl@0: sl@0: // Get the preferred collation method. sl@0: // Note that some Charsets may contain more than one Collation sl@0: // method (e.g "dictionary" v "phonebook" ordering) so an optional sl@0: // index parameter can be used to select between them sl@0: IMPORT_C TCollationMethod GetPreferredCollationMethod(TInt index = 0) ; sl@0: sl@0: //Get the Currency Symbol sl@0: IMPORT_C TPtrC GetCurrencySymbol(); sl@0: sl@0: //Get the Long Date Format sl@0: IMPORT_C TPtrC GetLongDateFormatSpec(); sl@0: sl@0: //Get the Short Date Format sl@0: IMPORT_C TPtrC GetShortDateFormatSpec(); sl@0: sl@0: //Get the Time Format sl@0: IMPORT_C TPtrC GetTimeFormatSpec(); sl@0: sl@0: // Retrieve a reference to the encapsulated TLocale sl@0: inline TLocale* GetLocale(); sl@0: sl@0: private: sl@0: sl@0: TInt DoLoadLocale(const TDesC& aLocaleDllName, TLibraryFunction* aExportList); sl@0: void DoUpdateLanguageSettings(TLibraryFunction* aExportList); sl@0: void DoUpdateLocaleSettings(TLibraryFunction* aExportList); sl@0: void DoUpdateTimeDateFormat(TLibraryFunction* aExportList); sl@0: sl@0: #ifdef SYMBIAN_DISTINCT_LOCALE_MODEL sl@0: void DoUpdateLanguageSettingsV2(TLibraryFunction* aExportList); sl@0: void DoUpdateLocaleSettingsV2(TLibraryFunction* aExportList); sl@0: TInt CheckLocaleDllName(const TDesC& aLocaleDllName, TInt& languageID); sl@0: void AddExtension(TDes& aFileName, TInt aExtension); sl@0: #endif sl@0: sl@0: private: sl@0: sl@0: TLocale iLocale; sl@0: SLocaleLanguage iLanguageSettings; sl@0: SLocaleLocaleSettings iLocaleExtraSettings; sl@0: SLocaleTimeDateFormat iLocaleTimeDateFormat; sl@0: const LCharSet* iDefaultCharSet; sl@0: const LCharSet* iPreferredCharSet; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Geometric rectangle. sl@0: sl@0: The class represents a rectangle whose sides are parallel with the axes of sl@0: the co-ordinate system. sl@0: sl@0: The co-ordinates of the top-left and bottom-right corners are used to set sl@0: the dimensions of the rectangle. The bottom right co-ordinate is outside the sl@0: rectangle. Thus TRect(TPoint(2,2),TSize(4,4)) is equal sl@0: to TRect(TPoint(2,2),TPoint(6,6)), sl@0: and in both cases you get a 4x4 pixel rectangle on the screen. sl@0: sl@0: Functions are provided to initialise and manipulate the rectangle and to extract sl@0: information about it. sl@0: */ sl@0: class TRect sl@0: { sl@0: public: sl@0: enum TUninitialized { EUninitialized }; sl@0: /** sl@0: Constructs a default rectangle. sl@0: sl@0: This initialises the co-ordinates of its top sl@0: left and bottom right corners to (0,0). sl@0: */ sl@0: TRect(TUninitialized) {} sl@0: IMPORT_C TRect(); sl@0: IMPORT_C TRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy); sl@0: IMPORT_C TRect(const TPoint& aPointA,const TPoint& aPointB); sl@0: IMPORT_C TRect(const TPoint& aPoint,const TSize& aSize); sl@0: IMPORT_C TRect(const TSize& aSize); sl@0: IMPORT_C TBool operator==(const TRect& aRect) const; sl@0: IMPORT_C TBool operator!=(const TRect& aRect) const; sl@0: IMPORT_C void SetRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy); sl@0: IMPORT_C void SetRect(const TPoint& aPointTL,const TPoint& aPointBR); sl@0: IMPORT_C void SetRect(const TPoint& aPoint,const TSize& aSize); sl@0: IMPORT_C void Move(TInt aDx,TInt aDy); sl@0: IMPORT_C void Move(const TPoint& aOffset); sl@0: IMPORT_C void Resize(TInt aDx,TInt aDy); sl@0: IMPORT_C void Resize(const TSize& aSize); sl@0: IMPORT_C void Shrink(TInt aDx,TInt aDy); sl@0: IMPORT_C void Shrink(const TSize& aSize); sl@0: IMPORT_C void Grow(TInt aDx,TInt aDy); sl@0: IMPORT_C void Grow(const TSize& aSize); sl@0: IMPORT_C void BoundingRect(const TRect& aRect); sl@0: IMPORT_C TBool IsEmpty() const; sl@0: IMPORT_C TBool Intersects(const TRect& aRect) const; sl@0: IMPORT_C void Intersection(const TRect& aRect); sl@0: IMPORT_C void Normalize(); sl@0: IMPORT_C TBool Contains(const TPoint& aPoint) const; sl@0: IMPORT_C TSize Size() const; sl@0: IMPORT_C TInt Width() const; sl@0: IMPORT_C TInt Height() const; sl@0: IMPORT_C TBool IsNormalized() const; sl@0: IMPORT_C TPoint Center() const; sl@0: IMPORT_C void SetSize(const TSize& aSize); sl@0: IMPORT_C void SetWidth(TInt aWidth); sl@0: IMPORT_C void SetHeight(TInt aHeight); sl@0: private: sl@0: void Adjust(TInt aDx,TInt aDy); sl@0: public: sl@0: /** sl@0: The x and y co-ordinates of the top left hand corner of the rectangle. sl@0: */ sl@0: TPoint iTl; sl@0: sl@0: /** sl@0: The x and y co-ordinates of the bottom right hand corner of the rectangle. sl@0: */ sl@0: TPoint iBr; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Clipping region - abstract base class. sl@0: sl@0: This abstract base class represents a 2-dimensional area which is used by sl@0: Graphics, the graphics window server, and the text window server to define sl@0: regions of the display which need to be updated, or regions within which all sl@0: operations must occur. sl@0: sl@0: A TRegion is defined in terms of an array of TRects and the more complex the sl@0: region, the more TRects are required to represent it. sl@0: sl@0: A clipping region initially has space allocated for five rectangles. sl@0: If manipulations result in a region which requires more than this, an attempt sl@0: is made to allocate more rectangles. If this cannot be done, an error flag sl@0: is set, and all subsequent operations involving the region have no effect sl@0: (except possibly to propagate the error flag to other regions). sl@0: The CheckError() member function allows sl@0: the error flag to be tested; Clear() can be used to clear it. sl@0: sl@0: The redraw logic of application programs may use the TRegion in various ways: sl@0: sl@0: 1. minimally, they pass it to the graphics context as the clipping region; when sl@0: a graphics context is activated to a window, the clipping region is set up sl@0: automatically sl@0: sl@0: 2. if they wish to avoid redrawing objects which are outside the general area sl@0: of the region, they may use TRegion::BoundingRect() to return the rectangle sl@0: which bounds the clipping region, and draw only primitives that lie within sl@0: that rectangle sl@0: sl@0: 3. if they wish to exercise finer control, they may extract the individual rectangles sl@0: that comprise the clipping region using Operator[](). sl@0: sl@0: Application programs may also manipulate clipping regions in order to constrain sl@0: parts of their redrawing to narrower areas of the screen than the clipping sl@0: region offered by the window server. To do this, functions that allow clipping sl@0: region manipulation may be used; for example, adding or removing rectangles sl@0: or finding the intersection or union of two regions. sl@0: */ sl@0: class TRegion sl@0: { sl@0: public: sl@0: inline TInt Count() const; sl@0: inline const TRect* RectangleList() const; sl@0: inline TBool CheckError() const; sl@0: IMPORT_C TBool IsEmpty() const; sl@0: IMPORT_C TRect BoundingRect() const; sl@0: IMPORT_C const TRect& operator[](TInt aIndex) const; sl@0: IMPORT_C void Copy(const TRegion& aRegion); sl@0: IMPORT_C void AddRect(const TRect& aRect); sl@0: IMPORT_C void SubRect(const TRect& aRect,TRegion* aSubtractedRegion=NULL); sl@0: IMPORT_C void Offset(TInt aXoffset,TInt aYoffset); sl@0: IMPORT_C void Offset(const TPoint& aOffset); sl@0: IMPORT_C void Union(const TRegion& aRegion); sl@0: IMPORT_C void Intersection(const TRegion& aRegion,const TRegion& aRegion2); sl@0: IMPORT_C void Intersect(const TRegion& aRegion); sl@0: IMPORT_C void SubRegion(const TRegion& aRegion,TRegion* aSubtractedRegion=NULL); sl@0: IMPORT_C void ClipRect(const TRect& aRect); sl@0: IMPORT_C void Clear(); sl@0: IMPORT_C void Tidy(); sl@0: IMPORT_C TInt Sort(); sl@0: IMPORT_C TInt Sort(const TPoint& aOffset); sl@0: IMPORT_C void ForceError(); sl@0: IMPORT_C TBool IsContainedBy(const TRect& aRect) const; sl@0: IMPORT_C TBool Contains(const TPoint& aPoint) const; sl@0: IMPORT_C TBool Intersects(const TRect& aRect) const; sl@0: protected: sl@0: IMPORT_C TRect* RectangleListW(); sl@0: IMPORT_C TRegion(TInt aAllocedRects); sl@0: inline TRegion(); sl@0: TBool SetListSize(TInt aCount); sl@0: void AppendRect(const TRect& aRect); sl@0: void DeleteRect(TRect* aRect); sl@0: void AppendRegion(TRegion& aRegion); sl@0: void MergeRect(const TRect& aRect, TBool aEnclosed); sl@0: void SubtractRegion(const TRegion &aRegion,TRegion *aSubtractedRegion=NULL); sl@0: void ShrinkRegion(); sl@0: TRect* ExpandRegion(TInt aCount); sl@0: protected: sl@0: TInt iCount; sl@0: TBool iError; sl@0: TInt iAllocedRects; sl@0: protected: sl@0: enum {ERRegionBuf=0x40000000}; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Expandable region. sl@0: sl@0: This class provides for the construction and destruction of a TRegion, including sl@0: a granularity for expanding the region. A region;s granularity represents sl@0: the number of memory slots allocated when the object is created, and the number sl@0: of new memory slots allocated each time an RRegion is expanded beyond the sl@0: number of free slots. The default granularity is five. sl@0: */ sl@0: class RRegion : public TRegion sl@0: { sl@0: private: sl@0: enum {EDefaultGranularity=5}; sl@0: protected: sl@0: IMPORT_C RRegion(TInt aBuf,TInt aGran); sl@0: public: sl@0: IMPORT_C RRegion(); sl@0: IMPORT_C RRegion(TInt aGran); sl@0: IMPORT_C RRegion(const RRegion& aRegion); sl@0: IMPORT_C RRegion(const TRect& aRect,TInt aGran=EDefaultGranularity); sl@0: IMPORT_C RRegion(TInt aCount,TRect* aRectangleList,TInt aGran=EDefaultGranularity); sl@0: IMPORT_C void Close(); sl@0: IMPORT_C void Destroy(); sl@0: inline TInt CheckSpare() const; sl@0: private: sl@0: TInt iGranularity; sl@0: TRect* iRectangleList; sl@0: friend class TRegion; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Region with pre-allocated buffer. sl@0: sl@0: This class provides the functionality of an RRegion, but in addition, for sl@0: optimisation purposes, uses a buffer containing pre-allocated space for as sl@0: many rectangles as are specified in the granularity. sl@0: sl@0: When this buffer is full, cell allocation takes place as for an RRegion, and sl@0: the RRegionBuf effectively becomes an RRegion. In this case, the region does sl@0: not revert to using the buffer, even if the region were to shrink so that sl@0: the buffer could, once again, contain the region. When the region is no longer sl@0: required, call Close(), defined in the base class RRegion, to free up all sl@0: memory. sl@0: */ sl@0: template sl@0: class RRegionBuf : public RRegion sl@0: { sl@0: public: sl@0: inline RRegionBuf(); sl@0: inline RRegionBuf(const RRegion& aRegion); sl@0: inline RRegionBuf(const RRegionBuf& aRegion); sl@0: inline RRegionBuf(const TRect& aRect); sl@0: private: sl@0: TInt8 iRectangleBuf[S*sizeof(TRect)]; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A fixed size region. sl@0: sl@0: The region consists of a fixed number of rectangles; this number is specified sl@0: in the templated argument. The region cannot be expanded to contain more than sl@0: this number of rectangles. If an attempt is made to do so, the region's sl@0: error flag is set, and the region is cleared. sl@0: sl@0: Note that when adding a rectangle to a region, if that rectangle overlaps sl@0: an existing rectangle, the operation causes more than one rectangle to be sl@0: created. sl@0: */ sl@0: template sl@0: class TRegionFix : public TRegion sl@0: { sl@0: public: sl@0: inline TRegionFix(); sl@0: inline TRegionFix(const TRect& aRect); sl@0: inline TRegionFix(const TRegionFix& aRegion); sl@0: private: sl@0: TInt8 iRectangleBuf[S*sizeof(TRect)]; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Base class for searching for global kernel objects. sl@0: sl@0: This is the base class for a number of classes which are used to find specific sl@0: types of global kernel object such as semaphores, threads and mutexes; sl@0: TFindSemaphore, TFindThread and TFindMutex are typical examples of such sl@0: derived classes. sl@0: sl@0: The class implements the common behaviour, specifically, the storage of the sl@0: match pattern which is used to search for object names. sl@0: sl@0: This class is not intended to be explicitly instantiated; it has public sl@0: constructors but they are part of the class implementation and are described sl@0: for information only. sl@0: */ sl@0: class TFindHandleBase : public TFindHandle sl@0: { sl@0: public: sl@0: IMPORT_C TFindHandleBase(); sl@0: IMPORT_C TFindHandleBase(const TDesC& aMatch); sl@0: IMPORT_C void Find(const TDesC& aMatch); sl@0: protected: sl@0: TInt NextObject(TFullName& aResult,TInt aObjectType); sl@0: private: sl@0: sl@0: /** sl@0: The full name of the last kernel side object found. sl@0: */ sl@0: TFullName iMatch; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Finds all global semaphores whose full names match a specified pattern. sl@0: sl@0: The match pattern can be set into the TFindSemaphore object at construction; sl@0: it can also be changed at any time after construction by using the Find() sl@0: member function of the TFindHandleBase base class. sl@0: sl@0: After construction, the Next() member function can be used repeatedly to find sl@0: successive global semaphores whose full names match the current pattern. sl@0: sl@0: A successful call to Next() means that a matching global semaphore has been sl@0: found. To open a handle on this semaphore, call the RSemaphore::Open() function sl@0: and pass a reference to this TFindSemaphore. sl@0: sl@0: Pattern matching is part of descriptor behaviour. sl@0: sl@0: @see TFindHandleBase::Find sl@0: @see TFindSemaphore::Next sl@0: @see RSemaphore::Open sl@0: @see TDesC16::Match sl@0: @see TDesC8::Match sl@0: */ sl@0: class TFindSemaphore : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindSemaphore(); sl@0: inline TFindSemaphore(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Finds all global mutexes whose full names match a specified pattern. sl@0: sl@0: The match pattern can be set into the object at construction; it can also sl@0: be changed at any time after construction by using the Find() member function sl@0: of the base class. sl@0: sl@0: After construction, the Next() member function may be used repeatedly to find sl@0: successive global mutexes whose full names match the current pattern. sl@0: sl@0: A successful call to Next() means that a matching global mutex has been found. sl@0: To open a handle on this mutex, call the Open() member function of RMutex sl@0: and pass a reference to this TFindMutex object. sl@0: sl@0: Pattern matching is part of descriptors behaviour. sl@0: sl@0: @see TFindHandleBase::Find sl@0: @see TFindMutex::Next sl@0: @see RMutex::Open sl@0: @see TDesC16::Match sl@0: @see TDesC8::Match sl@0: */ sl@0: class TFindMutex : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindMutex(); sl@0: inline TFindMutex(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for all global chunks by pattern matching against the names of (Kernel sl@0: side) chunk objects. sl@0: sl@0: The match pattern can be set into this object at construction; it can also sl@0: be changed at any time after construction by using TFindHandleBase::Find(). sl@0: sl@0: After construction, call TFindChunk::Next() repeatedly to find successive sl@0: chunks whose names match the current pattern. A successful call sl@0: to TFindChunk::Next() means that a matching chunk has been found. sl@0: sl@0: @see TFindHandleBase sl@0: */ sl@0: class TFindChunk : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindChunk(); sl@0: inline TFindChunk(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for threads by pattern matching against the names sl@0: of thread objects. sl@0: sl@0: The match pattern can be set into this object at construction; it can also be sl@0: changed at any time after construction by using TFindHandleBase::Find(). sl@0: sl@0: After construction, call TFindThread::Next() repeatedly to find successive sl@0: threads whose names match the current pattern. sl@0: A successful call to TFindThread::Next() means that a matching thread has sl@0: been found. To open a handle on this thread, call RThread::Open() and pass sl@0: a reference to this TFindThread. sl@0: sl@0: @see RThread sl@0: */ sl@0: class TFindThread : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindThread(); sl@0: inline TFindThread(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for processes by pattern matching against the names sl@0: of process objects. sl@0: sl@0: The match pattern can be set into this object at construction; it can also be sl@0: changed at any time after construction by using TFindHandleBase::Find(). sl@0: sl@0: After construction, call TFindProcess::Next() repeatedly to find successive sl@0: processes whose names match the current pattern. sl@0: A successful call to TFindProcess::Next() means that a matching process has sl@0: been found. To open a handle on this process, call RProcess::Open() and pass sl@0: a reference to this TFindProcess. sl@0: sl@0: @see RProcess sl@0: */ sl@0: class TFindProcess : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindProcess(); sl@0: inline TFindProcess(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for LDD factory objects by pattern matching against the names of sl@0: LDD factory objects. sl@0: sl@0: An LDD factory object is an instance of a DLogicalDevice derived class. sl@0: sl@0: The match pattern can be set into this object at construction; it can also sl@0: be changed at any time after construction by using TFindHandleBase::Find(). sl@0: sl@0: After construction, call TFindLogicalDevice::Next() repeatedly to find successive sl@0: LDD factory objects whose names match the current pattern. A successful call to sl@0: TFindLogicalDevice::Next() means that a matching LDD factory object has been found. sl@0: sl@0: The name of an LDD factory object is set by its Install() member function as sl@0: part of the construction process. sl@0: */ sl@0: class TFindLogicalDevice : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindLogicalDevice(); sl@0: inline TFindLogicalDevice(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for PDD factory objects by pattern matching against the names of sl@0: PDD factory objects. sl@0: sl@0: A PDD factory object is an instance of a DPhysicalDevice derived class. sl@0: sl@0: The match pattern can be set into this object at construction; it can also be sl@0: changed at any time after construction by using TFindHandleBase::Find(). sl@0: sl@0: After construction, call TFindPhysicalDevice::Next() repeatedly to find successive sl@0: PDD factory objects whose names match the current pattern. A successful call to sl@0: TFindPhysicalDevice::Next() means that a matching PDD factory object has been found. sl@0: sl@0: The name of a PDD factory object is set by its Install() member function as part sl@0: of the construction process. sl@0: */ sl@0: class TFindPhysicalDevice : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindPhysicalDevice(); sl@0: inline TFindPhysicalDevice(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for servers by pattern matching against the names of kernel side sl@0: server objects. sl@0: sl@0: The match pattern can be set into this object at construction; it can also sl@0: be changed at any time after construction by using the TFindHandleBase::Find() sl@0: base class. sl@0: sl@0: After construction, call TFindServer::Next() repeatedly to find successive sl@0: servers whose names match the current pattern. sl@0: A successful call to TFindServer::Next() means that a matching server sl@0: has been found. sl@0: */ sl@0: class TFindServer : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindServer(); sl@0: inline TFindServer(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Searches for DLLs whose full names match a specified pattern. sl@0: sl@0: The match pattern is set at construction but can also be changed at any time sl@0: after construction by using TFindHandleBase::Find(). sl@0: sl@0: After construction, use TFindLibrary::Next() to repeatedly find successive DLLs sl@0: whose names match the current pattern. A successful call to sl@0: TFindLibrary::Next() means that a matching DLL has been found. sl@0: */ sl@0: class TFindLibrary : public TFindHandleBase sl@0: { sl@0: public: sl@0: inline TFindLibrary(); sl@0: inline TFindLibrary(const TDesC& aMatch); sl@0: IMPORT_C TInt Next(TFullName& aResult); sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: User side handle to an LDD factory object, an instance of a DLogicalDevice sl@0: derived class. sl@0: sl@0: The LDD factory object is a Kernel side object which is constructed on the sl@0: Kernel heap when the logical device is opened using User::LoadLogicalDevice(). sl@0: The handle allows the User side to get information about the logical device. sl@0: sl@0: To use the device, a thread must create and use an instance of an sl@0: RBusLogicalChannel derived class. sl@0: sl@0: */ sl@0: class RDevice : public RHandleBase sl@0: { sl@0: public: sl@0: inline TInt Open(const TFindLogicalDevice& aFind,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(const TDesC& aName,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C void GetCaps(TDes8& aDes) const; sl@0: IMPORT_C TBool QueryVersionSupported(const TVersion& aVer) const; sl@0: IMPORT_C TBool IsAvailable(TInt aUnit, const TDesC* aPhysicalDevice, const TDesC8* anInfo) const; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Asynchronous timer services. sl@0: sl@0: Five types of asynchronous request are supported by the class: sl@0: sl@0: 1. Requesting an event after a specified interval sl@0: sl@0: 2. Requesting an event at a specified system time sl@0: sl@0: 3. Requesting a timer event on a specific second fraction sl@0: sl@0: 4. Requesting an event if an interval elapses with no user activity. sl@0: sl@0: 5. Requesting an event after a specified interval, to a resolution of 1ms. sl@0: sl@0: Each of these requests can be cancelled. sl@0: sl@0: The timer exists from its creation, following a call to RTimer::CreateLocal(), sl@0: until it is destroyed by a call to the Close() member function of the base sl@0: class RHandleBase. sl@0: sl@0: This class is ultimately implemented in terms of the nanokernel tick, and sl@0: therefore the granularity of the generated events is limited to the period of sl@0: this timer. This is variant specific, but is usually 1 millisecond. sl@0: sl@0: Note that the CTimer active object uses an RTimer. sl@0: */ sl@0: class RTimer : public RHandleBase sl@0: { sl@0: public: sl@0: IMPORT_C TInt CreateLocal(); sl@0: IMPORT_C void Cancel(); sl@0: IMPORT_C void After(TRequestStatus& aStatus,TTimeIntervalMicroSeconds32 anInterval); sl@0: IMPORT_C void AfterTicks(TRequestStatus &aStatus, TInt aTicks); sl@0: IMPORT_C void At(TRequestStatus& aStatus,const TTime& aTime); sl@0: IMPORT_C void AtUTC(TRequestStatus& aStatus,const TTime& aUTCTime); sl@0: IMPORT_C void Lock(TRequestStatus& aStatus,TTimerLockSpec aLock); sl@0: IMPORT_C void Inactivity(TRequestStatus& aStatus, TTimeIntervalSeconds aSeconds); sl@0: IMPORT_C void HighRes(TRequestStatus& aStatus,TTimeIntervalMicroSeconds32 anInterval); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a dynamically loadable DLL. sl@0: sl@0: The class is not intended for user derivation. sl@0: */ sl@0: class RLibrary : public RHandleBase sl@0: { sl@0: public: sl@0: IMPORT_C void Close(); sl@0: IMPORT_C TInt Load(const TDesC& aFileName, const TUidType& aType); sl@0: IMPORT_C TInt Load(const TDesC& aFileName, const TDesC& aPath=KNullDesC); sl@0: IMPORT_C TInt Load(const TDesC& aFileName, const TDesC& aPath, const TUidType& aType); sl@0: IMPORT_C TInt Load(const TDesC& aFileName, const TDesC& aPath, const TUidType& aType, TUint32 aModuleVersion); sl@0: IMPORT_C TInt LoadRomLibrary(const TDesC& aFileName, const TDesC& aPath); sl@0: IMPORT_C TLibraryFunction Lookup(TInt anOrdinal) const; sl@0: IMPORT_C TUidType Type() const; sl@0: IMPORT_C TFileName FileName() const; sl@0: IMPORT_C TInt GetRamSizes(TInt& aCodeSize, TInt& aConstDataSize); sl@0: IMPORT_C TInt Init(); /**< @internalTechnology */ sl@0: public: sl@0: /** sl@0: Class representing information about an executable binary, (DLL or EXE). sl@0: @internalTechnology sl@0: */ sl@0: struct TInfo sl@0: { sl@0: TUint32 iModuleVersion; /**< Version number */ sl@0: TUidType iUids; /**< UIDs */ sl@0: TSecurityInfo iSecurityInfo; /**< Security Info */ sl@0: }; sl@0: sl@0: /** sl@0: Class representing information about an executable binary, (DLL or EXE), version 2. sl@0: @internalTechnology sl@0: */ sl@0: struct TInfoV2 : public TInfo sl@0: { sl@0: TUint8 iHardwareFloatingPoint; /**< Which hardware floating point used, from TFloatingPointType */ sl@0: enum TDebugAttributes sl@0: { sl@0: EDebugAllowed = 1<<0, ///< Flags set if executable may be debugged. sl@0: ETraceAllowed = 1<<1 ///< Flags set if executable may be traced. sl@0: }; sl@0: TUint8 iDebugAttributes; ///< Bitmask of values from enum TDebugAttributes sl@0: TUint8 iSpare[6]; sl@0: }; sl@0: sl@0: /** sl@0: Type representing a TInfo struct packaged as a descriptor. sl@0: @internalTechnology sl@0: */ sl@0: typedef TPckgBuf TInfoBuf; sl@0: sl@0: /** sl@0: Type representing a TInfo struct packaged as a descriptor, version 2. sl@0: @internalTechnology sl@0: */ sl@0: typedef TPckgBuf TInfoBufV2; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: enum TRequiredImageHeaderSize sl@0: { sl@0: #ifdef __WINS__ sl@0: /** sl@0: Size of header data which should be passed to GetInfoFromHeader() sl@0: */ sl@0: KRequiredImageHeaderSize = KMaxTInt sl@0: #else sl@0: KRequiredImageHeaderSize = 9*1024 sl@0: #endif sl@0: }; sl@0: sl@0: IMPORT_C static TInt GetInfoFromHeader(const TDesC8& aHeader, TDes8& aInfoBuf); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @deprecated Use TInfo sl@0: */ sl@0: struct SInfo sl@0: { sl@0: TUint32 iModuleVersion; sl@0: TUidType iUids; sl@0: SSecurityInfo iS; sl@0: }; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @deprecated Use TInfoBuf sl@0: */ sl@0: typedef TPckgBuf SInfoBuf; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: IMPORT_C static TInt GetInfo(const TDesC& aFileName, TDes8& aInfoBuf); sl@0: private: sl@0: TInt InitL(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a critical section. sl@0: sl@0: A critical section itself is a kernel object, and is implemented using sl@0: a semaphore. The class RCriticalSection inherits privately from RSemaphore sl@0: as a matter of implementation and this is, in effect, equivalent to using sl@0: a semaphore. sl@0: sl@0: The public functions of RSemaphore are not part of the public API of this sl@0: class. sl@0: sl@0: As with all handles, they should be closed after use. This class provides sl@0: the necessary Close() function, which should be called when the handle is sl@0: no longer required. sl@0: sl@0: @see RHandleBase::Close sl@0: */ sl@0: class RCriticalSection : private RSemaphore sl@0: { sl@0: public: sl@0: IMPORT_C RCriticalSection(); sl@0: IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C void Close(); sl@0: IMPORT_C void Wait(); sl@0: IMPORT_C void Signal(); sl@0: inline TBool IsBlocked() const; sl@0: private: sl@0: TInt iBlocked; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a mutex. sl@0: sl@0: The mutex itself is a kernel side object. sl@0: sl@0: Handles should be closed after use. RHandleBase provides the necessary Close() sl@0: function which should be called when the handle is no longer required. sl@0: sl@0: @see RHandleBase::Close sl@0: */ sl@0: class RMutex : public RHandleBase sl@0: { sl@0: public: sl@0: inline TInt Open(const TFindMutex& aFind,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt OpenGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C void Wait(); sl@0: IMPORT_C void Signal(); sl@0: IMPORT_C TBool IsHeld(); sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a condition variable. sl@0: sl@0: The condition variable itself is a kernel side object. sl@0: sl@0: Handles should be closed after use. RHandleBase provides the necessary Close() sl@0: function which should be called when the handle is no longer required. sl@0: sl@0: @see RHandleBase::Close sl@0: */ sl@0: class RCondVar : public RHandleBase sl@0: { sl@0: public: sl@0: IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateGlobal(const TDesC& aName, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt OpenGlobal(const TDesC& aName, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(RMessagePtr2 aMessage, TInt aParam, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Wait(RMutex& aMutex); sl@0: IMPORT_C TInt TimedWait(RMutex& aMutex, TInt aTimeout); // timeout in microseconds sl@0: IMPORT_C void Signal(); sl@0: IMPORT_C void Broadcast(); sl@0: }; sl@0: sl@0: sl@0: sl@0: class UserHeap; sl@0: class TChunkCreate; sl@0: struct TChunkCreateInfo; sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a chunk. sl@0: sl@0: The chunk itself is a kernel side object. sl@0: */ sl@0: class RChunk : public RHandleBase sl@0: { sl@0: public: sl@0: /** sl@0: Set of flags used by SetRestrictions(). sl@0: sl@0: @see RChunk::SetRestrictions sl@0: */ sl@0: enum TRestrictions sl@0: { sl@0: /** Prevent Adjust, Commit, Allocate and Decommit */ sl@0: EPreventAdjust = 0x01, sl@0: }; sl@0: public: sl@0: inline TInt Open(const TFindChunk& aFind,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateLocal(TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateLocalCode(TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateGlobal(const TDesC& aName,TInt aSize,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateDoubleEndedLocal(TInt aInitialBottom, TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateDoubleEndedGlobal(const TDesC& aName,TInt aInitialBottom,TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateDisconnectedLocal(TInt aInitialBottom, TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt CreateDisconnectedGlobal(const TDesC& aName,TInt aInitialBottom,TInt aInitialTop,TInt aMaxSize,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Create(TChunkCreateInfo& aCreateInfo); sl@0: IMPORT_C TInt SetRestrictions(TUint aFlags); sl@0: IMPORT_C TInt OpenGlobal(const TDesC& aName,TBool isReadOnly,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TBool isReadOnly,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Adjust(TInt aNewSize) const; sl@0: IMPORT_C TInt AdjustDoubleEnded(TInt aBottom, TInt aTop) const; sl@0: IMPORT_C TInt Commit(TInt anOffset, TInt aSize) const; sl@0: IMPORT_C TInt Allocate(TInt aSize) const; sl@0: IMPORT_C TInt Decommit(TInt anOffset, TInt aSize) const; sl@0: IMPORT_C TInt Unlock(TInt aOffset, TInt aSize); /**< @internalTechnology */ sl@0: IMPORT_C TInt Lock(TInt aOffset, TInt aSize); /**< @internalTechnology */ sl@0: IMPORT_C TUint8* Base() const; sl@0: IMPORT_C TInt Size() const; sl@0: IMPORT_C TInt Bottom() const; sl@0: IMPORT_C TInt Top() const; sl@0: IMPORT_C TInt MaxSize() const; sl@0: inline TBool IsReadable() const; sl@0: inline TBool IsWritable() const; sl@0: IMPORT_C TBool IsPaged() const; sl@0: private: sl@0: friend class UserHeap; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: This structure specifies the type and properties of the chunk to be created. It sl@0: is passed as a parameter to the RChunk::Create() method. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: struct TChunkCreateInfo sl@0: { sl@0: public : sl@0: /** sl@0: Currently supported version numbers sl@0: @internalComponent sl@0: */ sl@0: enum TChunkCreateVersions sl@0: { sl@0: EVersion0, sl@0: ESupportedVersions, sl@0: }; sl@0: sl@0: friend class RChunk; sl@0: sl@0: /** sl@0: Attributes that specify whether the chunk to be created is data paged or not. sl@0: */ sl@0: enum TChunkPagingAtt sl@0: { sl@0: EUnspecified, /**< The chunk will use the creating process's paging attributes.*/ sl@0: EPaged, /**< The chunk will be data paged.*/ sl@0: EUnpaged, /**< The chunk will not be data paged.*/ sl@0: }; sl@0: sl@0: IMPORT_C TChunkCreateInfo(); sl@0: IMPORT_C void SetNormal(TInt aInitialSize, TInt aMaxSize); sl@0: IMPORT_C void SetCode(TInt aInitialSize, TInt aMaxSize); sl@0: IMPORT_C void SetDoubleEnded(TInt aInitialBottom, TInt aInitialTop, TInt aMaxSize); sl@0: IMPORT_C void SetDisconnected(TInt aInitialBottom, TInt aInitialTop, TInt aMaxSize); sl@0: IMPORT_C void SetOwner(TOwnerType aType); sl@0: IMPORT_C void SetGlobal(const TDesC& aName); sl@0: IMPORT_C void SetClearByte(TUint8 aClearByte); sl@0: IMPORT_C void SetPaging(const TChunkPagingAtt aPaging); sl@0: IMPORT_C void SetReadOnly(); sl@0: void SetThreadHeap(TInt aInitialSize, TInt aMaxSize, const TDesC& aName); sl@0: sl@0: /** sl@0: For use by file server only. sl@0: @internalTechnology sl@0: */ sl@0: IMPORT_C void SetCache(TInt aMaxSize); sl@0: protected : sl@0: /** The version number of this TChunkCreateInfo. sl@0: @internalComponent sl@0: */ sl@0: TUint iVersionNumber; sl@0: /** The type of the chunk to be created. sl@0: @internalComponent sl@0: */ sl@0: TUint iType; sl@0: /** Specify if chunk is global or not. sl@0: @internalComponent sl@0: */ sl@0: TBool iGlobal; sl@0: /** The maximum size in bytes of the chunk to be created. sl@0: @internalComponent sl@0: */ sl@0: TInt iMaxSize; sl@0: /** An enumeration whose enumerators define the ownership of this chunk sl@0: handle. If not explicitly specified, EOwnerProcess is taken as default. sl@0: @internalComponent sl@0: */ sl@0: TOwnerType iOwnerType; sl@0: /** A pointer to a descriptor containing the name to be assigned to sl@0: global chunks. The length of the descriptor must be no greater than sl@0: that allowed for a TKName type. Must be NULL for local chunks. sl@0: @internalComponent sl@0: */ sl@0: const TDesC* iName; sl@0: /** The offset of the bottom of the region to commit to the chunk on sl@0: creation from the base of the chunk's reserved region. sl@0: This is only used for double ended and disconnected chunks. sl@0: @internalComponent sl@0: */ sl@0: TInt iInitialBottom; sl@0: /** The offset of the top of the region to commit to the chunk on sl@0: creation from the base of the chunk's reserved region. sl@0: This is only used for double ended and disconnected chunks. sl@0: @internalComponent sl@0: */ sl@0: TInt iInitialTop; sl@0: /** Attributes to the chunk to be created should have. sl@0: Should be set from one or more the values in TChunkCreate::TChunkCreateAtt. sl@0: @internalComponent sl@0: */ sl@0: TUint iAttributes; sl@0: /** The byte to clear all the memory committed to the chunk to. sl@0: @internalComponent sl@0: */ sl@0: TUint8 iClearByte; sl@0: /** @internalComponent*/ sl@0: TUint8 iSpare1[3]; sl@0: /** @internalComponent*/ sl@0: TUint iSpare2; sl@0: }; sl@0: sl@0: /** sl@0: This structure specifies the type and properties of the user heap to be created. It sl@0: is passed as a parameter to the UserHeap::Create() method. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: struct TChunkHeapCreateInfo sl@0: { sl@0: public: sl@0: /** sl@0: Currently supported version numbers sl@0: @internalComponent sl@0: */ sl@0: enum TChunkHeapCreateVersions sl@0: { sl@0: EVersion0, sl@0: ESupportedVersions, sl@0: }; sl@0: sl@0: /** sl@0: Attributes that specify whether the chunk heap to be created is data paged or not. sl@0: */ sl@0: enum TChunkHeapPagingAtt sl@0: { sl@0: EUnspecified, /**< The chunk heap will use the creating process's paging attributes.*/ sl@0: EPaged, /**< The chunk heap will be data paged.*/ sl@0: EUnpaged, /**< The chunk heap will not be data paged.*/ sl@0: }; sl@0: sl@0: friend class UserHeap; sl@0: sl@0: IMPORT_C TChunkHeapCreateInfo(TInt aMinLength, TInt aMaxLength); sl@0: IMPORT_C void SetCreateChunk(const TDesC* aName); sl@0: IMPORT_C void SetUseChunk(const RChunk aChunk); sl@0: inline void SetSingleThread(TBool aSingleThread); sl@0: inline void SetAlignment(TInt aAlign); sl@0: inline void SetGrowBy(TInt aGrowBy); sl@0: inline void SetOffset(TInt aOffset); sl@0: inline void SetMode(TUint aMode); sl@0: inline void SetPaging(const TChunkHeapPagingAtt aPaging); sl@0: sl@0: protected: sl@0: /** The version number of this TChunkHeapCreateInfo. sl@0: @internalComponent sl@0: */ sl@0: TUint iVersionNumber; sl@0: /** The minimum size for the heap. sl@0: @internalConponent sl@0: */ sl@0: TInt iMinLength; sl@0: /** The maximum size for the heap. sl@0: @internalConponent sl@0: */ sl@0: TInt iMaxLength; sl@0: /** The alignment of the heap. sl@0: @internalComponent sl@0: */ sl@0: TInt iAlign; sl@0: /** The grow by value of the heap. sl@0: @internalComponent sl@0: */ sl@0: TInt iGrowBy; sl@0: /** The single thread value of the heap. sl@0: @internalComponent sl@0: */ sl@0: TBool iSingleThread; sl@0: /** The offset from the base of the chunk to the start of the heap. sl@0: @internalComponent sl@0: */ sl@0: TInt iOffset; sl@0: /** The paging attributes of the chunk. sl@0: @internalComponent sl@0: */ sl@0: TChunkHeapPagingAtt iPaging; sl@0: /** The mode flags for the heap. sl@0: @internalComponent sl@0: */ sl@0: TUint iMode; sl@0: /** The name of the chunk to be created for the heap. sl@0: @internalComponent sl@0: */ sl@0: TDesC* iName; sl@0: /** The chunk to use for the heap. sl@0: @internalComponent sl@0: */ sl@0: RChunk iChunk; sl@0: /**@internalComponent*/ sl@0: TInt iSpare[5]; sl@0: }; sl@0: sl@0: struct SStdEpocThreadCreateInfo; sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A set of static functions for constructing fixed length heaps and local or sl@0: global heaps. sl@0: sl@0: @see RHeap sl@0: @see RChunk sl@0: */ sl@0: class UserHeap sl@0: { sl@0: public: sl@0: /** sl@0: Flags to control the heap creation. sl@0: */ sl@0: enum TChunkHeapCreateMode sl@0: { sl@0: /** On successful creation of the heap this switches the calling thread to sl@0: use the new heap. sl@0: */ sl@0: EChunkHeapSwitchTo = 0x1, sl@0: /** On successful creation of the heap this causes the handle to the heap sl@0: to be duplicated. sl@0: */ sl@0: EChunkHeapDuplicate = 0x2, sl@0: sl@0: /** @internalComponent*/ sl@0: EChunkHeapMask = EChunkHeapSwitchTo | EChunkHeapDuplicate, sl@0: }; sl@0: IMPORT_C static RHeap* FixedHeap(TAny* aBase, TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue); sl@0: IMPORT_C static RHeap* ChunkHeap(const TDesC* aName, TInt aMinLength, TInt aMaxLength, TInt aGrowBy=1, TInt aAlign=0, TBool aSingleThread=EFalse); sl@0: IMPORT_C static RHeap* ChunkHeap(RChunk aChunk, TInt aMinLength, TInt aGrowBy=1, TInt aMaxLength=0, TInt aAlign=0, TBool aSingleThread=EFalse, TUint32 aMode=0); sl@0: IMPORT_C static RHeap* OffsetChunkHeap(RChunk aChunk, TInt aMinLength, TInt aOffset, TInt aGrowBy=1, TInt aMaxLength=0, TInt aAlign=0, TBool aSingleThread=EFalse, TUint32 aMode=0); sl@0: IMPORT_C static RHeap* ChunkHeap(const TChunkHeapCreateInfo& aCreateInfo); sl@0: IMPORT_C static TInt SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo); sl@0: IMPORT_C static TInt CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RHeap*& aHeap, TInt aAlign=0, TBool aSingleThread=EFalse); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Encapsulates the Id of a kernel object. sl@0: */ sl@0: class TObjectId sl@0: { sl@0: public: sl@0: inline TObjectId(); sl@0: inline TObjectId(TUint64 anId); sl@0: inline TUint64 Id() const; sl@0: inline operator TUint() const; sl@0: inline TBool operator==(TObjectId aId) const; sl@0: inline TBool operator!=(TObjectId aId) const; sl@0: private: sl@0: TUint64 iId; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Encapsulates the Id of a thread. sl@0: sl@0: An object of this type is not explicitly constructed in open code, sl@0: but is returned by the Id() member function of a thread handle, sl@0: an RThread type. sl@0: sl@0: @see RThread sl@0: */ sl@0: class TThreadId : public TObjectId sl@0: { sl@0: public: sl@0: inline TThreadId(); sl@0: inline TThreadId(TUint64 anId); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: This structure specifies the type and properties of the thread to be created. It sl@0: is passed as a parameter to the RThread::Create() method. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: struct TThreadCreateInfo sl@0: { sl@0: public : sl@0: /** sl@0: Currently supported version numbers sl@0: @internalComponent sl@0: */ sl@0: enum TThreadCreateVersions sl@0: { sl@0: EVersion0, sl@0: ESupportedVersions, sl@0: }; sl@0: sl@0: /** sl@0: Attributes that specify whether the stack and heap of the thread to be created sl@0: are data paged or not. sl@0: */ sl@0: enum TThreadPagingAtt sl@0: { sl@0: EUnspecified, /**< The thread will use the creating process's paging attributes.*/ sl@0: EPaged, /**< The thread will data page its stack and heap.*/ sl@0: EUnpaged, /**< The thread will not data page its stack and heap.*/ sl@0: }; sl@0: sl@0: friend class RThread; sl@0: sl@0: IMPORT_C TThreadCreateInfo( const TDesC &aName, TThreadFunction aFunction, sl@0: TInt aStackSize, TAny* aPtr); sl@0: IMPORT_C void SetCreateHeap(TInt aHeapMinSize, TInt aHeapMaxSize); sl@0: IMPORT_C void SetUseHeap(const RAllocator* aHeap); sl@0: IMPORT_C void SetOwner(const TOwnerType aOwner); sl@0: IMPORT_C void SetPaging(const TThreadPagingAtt aPaging); sl@0: sl@0: protected: sl@0: /** The version number of this TChunkCreateInfo. sl@0: @internalComponent sl@0: */ sl@0: TUint iVersionNumber; sl@0: /** The Name to be given to the thread to be created sl@0: @internalComponent sl@0: */ sl@0: const TDesC* iName; sl@0: /** The function this thread will execute. sl@0: @internalComponent sl@0: */ sl@0: TThreadFunction iFunction; sl@0: /** The size of the stack of the thread to be created. sl@0: @internalComponent sl@0: */ sl@0: TInt iStackSize; sl@0: /** The parameter to be passed to the function of the thread to be created. sl@0: @internalComponent sl@0: */ sl@0: TAny* iParameter; sl@0: /** The owner of the thread to be created. sl@0: @internalComponent sl@0: */ sl@0: TOwnerType iOwner; sl@0: /** The heap for the thread to be created to use. sl@0: NULL if a new heap is to be created. sl@0: @internalComponent sl@0: */ sl@0: RAllocator* iHeap; sl@0: /** Minimum size of any heap to be created for the thread. sl@0: @internalComponent*/ sl@0: TInt iHeapMinSize; sl@0: /** Maximum size of any heap to be created for the thread. sl@0: @internalComponent sl@0: */ sl@0: TInt iHeapMaxSize; sl@0: /** The attributes of the thread sl@0: @internalComponent sl@0: */ sl@0: TUint iAttributes; sl@0: /**@internalComponent*/ sl@0: TUint32 iSpare[6]; sl@0: }; sl@0: sl@0: class RProcess; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a thread. sl@0: sl@0: The thread itself is a kernel object. sl@0: */ sl@0: class RThread : public RHandleBase sl@0: { sl@0: public: sl@0: inline RThread(); sl@0: IMPORT_C TInt Create(const TDesC& aName, TThreadFunction aFunction, TInt aStackSize, TInt aHeapMinSize, TInt aHeapMaxSize, TAny *aPtr, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Create(const TDesC& aName, TThreadFunction aFunction, TInt aStackSize, RAllocator* aHeap, TAny* aPtr, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Create(const TThreadCreateInfo& aCreateInfo); sl@0: IMPORT_C TInt Open(const TDesC& aFullName, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TThreadId aID, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TThreadId Id() const; sl@0: IMPORT_C void Resume() const; sl@0: IMPORT_C void Suspend() const; sl@0: /** sl@0: @publishedAll sl@0: @deprecated Use User::RenameThread() instead sl@0: */ sl@0: inline static TInt RenameMe(const TDesC& aName); sl@0: sl@0: IMPORT_C void Kill(TInt aReason); sl@0: IMPORT_C void Terminate(TInt aReason); sl@0: IMPORT_C void Panic(const TDesC& aCategory,TInt aReason); sl@0: IMPORT_C TInt Process(RProcess& aProcess) const; sl@0: IMPORT_C TThreadPriority Priority() const; sl@0: IMPORT_C void SetPriority(TThreadPriority aPriority) const; sl@0: IMPORT_C TProcessPriority ProcessPriority() const; sl@0: IMPORT_C void SetProcessPriority(TProcessPriority aPriority) const; sl@0: IMPORT_C TInt RequestCount() const; sl@0: IMPORT_C TExitType ExitType() const; sl@0: IMPORT_C TInt ExitReason() const; sl@0: IMPORT_C TExitCategoryName ExitCategory() const; sl@0: IMPORT_C void RequestComplete(TRequestStatus*& aStatus,TInt aReason) const; sl@0: IMPORT_C void RequestSignal() const; sl@0: IMPORT_C void Logon(TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt LogonCancel(TRequestStatus& aStatus) const; sl@0: IMPORT_C void HandleCount(TInt& aProcessHandleCount, TInt& aThreadHandleCount) const; sl@0: IMPORT_C void Context(TDes8& aDes) const; sl@0: IMPORT_C TInt StackInfo(TThreadStackInfo& aInfo) const; sl@0: IMPORT_C TInt GetCpuTime(TTimeIntervalMicroSeconds& aCpuTime) const; sl@0: inline TInt Open(const TFindThread& aFind,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C void Rendezvous(TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt RendezvousCancel(TRequestStatus& aStatus) const; sl@0: IMPORT_C static void Rendezvous(TInt aReason); sl@0: sl@0: /** sl@0: Return the Secure ID of the process to which the thread belongs. sl@0: sl@0: If an intended use of this method is to check that the Secure ID is sl@0: a given value, then the use of a TSecurityPolicy object should be sl@0: considered. E.g. Instead of something like: sl@0: sl@0: @code sl@0: RThread& thread; sl@0: TInt error = thread.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied; sl@0: @endcode sl@0: sl@0: this could be used; sl@0: sl@0: @code sl@0: RThread& thread; sl@0: static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId); sl@0: TBool pass = mySidPolicy().CheckPolicy(thread); sl@0: @endcode sl@0: sl@0: This has the benefit that the TSecurityPolicy::CheckPolicy methods are sl@0: configured by the system wide Platform Security configuration. I.e. are sl@0: capable of emitting diagnostic messages when a check fails and/or the sl@0: check can be forced to always pass. sl@0: sl@0: @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const sl@0: @see _LIT_SECURITY_POLICY_S0 sl@0: sl@0: @return The Secure ID. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: IMPORT_C TSecureId SecureId() const; sl@0: sl@0: /** sl@0: Return the Vendor ID of the process to which the thread belongs. sl@0: sl@0: If an intended use of this method is to check that the Vendor ID is sl@0: a given value, then the use of a TSecurityPolicy object should be sl@0: considered. E.g. Instead of something like: sl@0: sl@0: @code sl@0: RThread& thread; sl@0: TInt error = thread.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied; sl@0: @endcode sl@0: sl@0: this could be used; sl@0: sl@0: @code sl@0: RThread& thread; sl@0: static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId); sl@0: TBool pass = myVidPolicy().CheckPolicy(thread); sl@0: @endcode sl@0: sl@0: This has the benefit that the TSecurityPolicy::CheckPolicy methods are sl@0: configured by the system wide Platform Security configuration. I.e. are sl@0: capable of emitting diagnostic messages when a check fails and/or the sl@0: check can be forced to always pass. sl@0: sl@0: @see TSecurityPolicy::CheckPolicy(RThread aThread, const char* aDiagnostic) const sl@0: @see _LIT_SECURITY_POLICY_V0 sl@0: sl@0: @return The Vendor ID. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: IMPORT_C TVendorId VendorId() const; sl@0: sl@0: /** sl@0: Check if the process to which the thread belongs has a given capability sl@0: sl@0: When a check fails the action taken is determined by the system wide Platform Security sl@0: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. sl@0: If PlatSecEnforcement is OFF, then this function will return ETrue even though the sl@0: check failed. sl@0: sl@0: @param aCapability The capability to test. sl@0: @param aDiagnostic A string that will be emitted along with any diagnostic message sl@0: that may be issued if the test finds the capability is not present. sl@0: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro sl@0: which enables it to be easily removed from the system. sl@0: @return ETrue if the process to which the thread belongs has the capability, EFalse otherwise. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const; sl@0: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: // Only available to NULL arguments sl@0: inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const; sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: // For things using KSuppressPlatSecDiagnostic sl@0: inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: sl@0: /** sl@0: Check if the process to which the thread belongs has both of the given capabilities sl@0: sl@0: When a check fails the action taken is determined by the system wide Platform Security sl@0: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. sl@0: If PlatSecEnforcement is OFF, then this function will return ETrue even though the sl@0: check failed. sl@0: sl@0: @param aCapability1 The first capability to test. sl@0: @param aCapability2 The second capability to test. sl@0: @param aDiagnostic A string that will be emitted along with any diagnostic message sl@0: that may be issued if the test finds a capability is not present. sl@0: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro sl@0: which enables it to be easily removed from the system. sl@0: @return ETrue if the process to which the thread belongs has both the capabilities, EFalse otherwise. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const; sl@0: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: // Only available to NULL arguments sl@0: inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const; sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: // For things using KSuppressPlatSecDiagnostic sl@0: inline TBool HasCapability(TCapability aCapability, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: sl@0: /** Function only temporarily supported to aid migration to process emulation... sl@0: sl@0: @publishedAll sl@0: @deprecated Use process emulation instead sl@0: */ sl@0: inline TInt Create(const TDesC& aName,TThreadFunction aFunction,TInt aStackSize,TAny* aPtr,RLibrary* aLibrary,RHeap* aHeap, TInt aHeapMinSize,TInt aHeapMaxSize,TOwnerType aType); sl@0: sl@0: private: sl@0: // Implementations of functions with diagnostics sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const; sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability) const; sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const; sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2) const; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @deprecated sl@0: */ sl@0: inline TInt RThread::Create(const TDesC& /*aName*/,TThreadFunction /*aFunction*/,TInt /*aStackSize*/,TAny* /*aPtr*/,RLibrary* /*aLibrary*/,RHeap* /*aHeap*/, TInt /*aHeapMinSize*/,TInt /*aHeapMaxSize*/,TOwnerType /*aType*/) sl@0: {return KErrNotSupported; } sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Encapsulates the Id of a process. sl@0: sl@0: An object of this type is not explicitly constructed in open code, sl@0: but is returned by the Id() member function of a process handle, sl@0: an RProcess type. sl@0: sl@0: @see RProcess sl@0: */ sl@0: class TProcessId : public TObjectId sl@0: { sl@0: public: sl@0: inline TProcessId(); sl@0: inline TProcessId(TUint64 anId); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: class RSubSessionBase; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a process. sl@0: sl@0: The process itself is a kernel object. sl@0: */ sl@0: class RProcess : public RHandleBase sl@0: { sl@0: public: sl@0: inline RProcess(); sl@0: IMPORT_C TInt Create(const TDesC& aFileName,const TDesC& aCommand,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Create(const TDesC& aFileName,const TDesC& aCommand,const TUidType &aUidType, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(const TDesC& aName,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TProcessId aId,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TUidType Type() const; sl@0: IMPORT_C TProcessId Id() const; sl@0: /** sl@0: @publishedAll sl@0: @deprecated Use User::RenameProcess() instead sl@0: */ sl@0: inline static TInt RenameMe(const TDesC& aName); sl@0: sl@0: IMPORT_C void Kill(TInt aReason); sl@0: IMPORT_C void Terminate(TInt aReason); sl@0: IMPORT_C void Panic(const TDesC& aCategory,TInt aReason); sl@0: IMPORT_C void Resume(); sl@0: IMPORT_C TFileName FileName() const; sl@0: IMPORT_C TExitType ExitType() const; sl@0: IMPORT_C TInt ExitReason() const; sl@0: IMPORT_C TExitCategoryName ExitCategory() const; sl@0: IMPORT_C TProcessPriority Priority() const; sl@0: IMPORT_C TInt SetPriority(TProcessPriority aPriority) const; sl@0: IMPORT_C TBool JustInTime() const; sl@0: IMPORT_C void SetJustInTime(TBool aBoolean) const; sl@0: IMPORT_C void Logon(TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt LogonCancel(TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt GetMemoryInfo(TModuleMemoryInfo& aInfo) const; sl@0: inline TInt Open(const TFindProcess& aFind,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C void Rendezvous(TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt RendezvousCancel(TRequestStatus& aStatus) const; sl@0: IMPORT_C static void Rendezvous(TInt aReason); sl@0: IMPORT_C TBool DefaultDataPaged() const; sl@0: sl@0: /** sl@0: Return the Secure ID of the process. sl@0: sl@0: If an intended use of this method is to check that the Secure ID is sl@0: a given value, then the use of a TSecurityPolicy object should be sl@0: considered. E.g. Instead of something like: sl@0: sl@0: @code sl@0: RProcess& process; sl@0: TInt error = process.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied; sl@0: @endcode sl@0: sl@0: this could be used; sl@0: sl@0: @code sl@0: RProcess& process; sl@0: static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId); sl@0: TBool pass = mySidPolicy().CheckPolicy(process); sl@0: @endcode sl@0: sl@0: This has the benefit that the TSecurityPolicy::CheckPolicy methods are sl@0: configured by the system wide Platform Security configuration. I.e. are sl@0: capable of emitting diagnostic messages when a check fails and/or the sl@0: check can be forced to always pass. sl@0: sl@0: @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) const sl@0: @see _LIT_SECURITY_POLICY_S0 sl@0: sl@0: @return The Secure ID. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: IMPORT_C TSecureId SecureId() const; sl@0: sl@0: /** sl@0: Return the Vendor ID of the process. sl@0: sl@0: If an intended use of this method is to check that the Vendor ID is sl@0: a given value, then the use of a TSecurityPolicy object should be sl@0: considered. E.g. Instead of something like: sl@0: sl@0: @code sl@0: RProcess& process; sl@0: TInt error = process.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied; sl@0: @endcode sl@0: sl@0: this could be used; sl@0: sl@0: @code sl@0: RProcess& process; sl@0: static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId); sl@0: TBool pass = myVidPolicy().CheckPolicy(process); sl@0: @endcode sl@0: sl@0: This has the benefit that the TSecurityPolicy::CheckPolicy methods are sl@0: configured by the system wide Platform Security configuration. I.e. are sl@0: capable of emitting diagnostic messages when a check fails and/or the sl@0: check can be forced to always pass. sl@0: sl@0: @see TSecurityPolicy::CheckPolicy(RProcess aProcess, const char* aDiagnostic) const sl@0: @see _LIT_SECURITY_POLICY_V0 sl@0: sl@0: @return The Vendor ID. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: IMPORT_C TVendorId VendorId() const; sl@0: sl@0: /** sl@0: Check if the process has a given capability sl@0: sl@0: When a check fails the action taken is determined by the system wide Platform Security sl@0: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. sl@0: If PlatSecEnforcement is OFF, then this function will return ETrue even though the sl@0: check failed. sl@0: sl@0: @param aCapability The capability to test. sl@0: @param aDiagnostic A string that will be emitted along with any diagnostic message sl@0: that may be issued if the test finds the capability is not present. sl@0: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro sl@0: which enables it to be easily removed from the system. sl@0: @return ETrue if the process has the capability, EFalse otherwise. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const; sl@0: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: // Only available to NULL arguments sl@0: inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const; sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: // For things using KSuppressPlatSecDiagnostic sl@0: inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: sl@0: /** sl@0: Check if the process has both of the given capabilities sl@0: sl@0: When a check fails the action taken is determined by the system wide Platform Security sl@0: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. sl@0: If PlatSecEnforcement is OFF, then this function will return ETrue even though the sl@0: check failed. sl@0: sl@0: @param aCapability1 The first capability to test. sl@0: @param aCapability2 The second capability to test. sl@0: @param aDiagnostic A string that will be emitted along with any diagnostic message sl@0: that may be issued if the test finds a capability is not present. sl@0: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro sl@0: which enables it to be easily removed from the system. sl@0: @return ETrue if the process has both the capabilities, EFalse otherwise. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const; sl@0: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: // Only available to NULL arguments sl@0: inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const; sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: // For things using KSuppressPlatSecDiagnostic sl@0: inline TBool HasCapability(TCapability aCapability, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const; sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: sl@0: IMPORT_C TInt SetParameter(TInt aIndex, RHandleBase aHandle); sl@0: IMPORT_C TInt SetParameter(TInt aSlot, const RSubSessionBase& aSession); sl@0: IMPORT_C TInt SetParameter(TInt aSlot, const TDesC16& aDes); sl@0: IMPORT_C TInt SetParameter(TInt aSlot, const TDesC8& aDes); sl@0: IMPORT_C TInt SetParameter(TInt aSlot, TInt aData); sl@0: inline RProcess(TInt aHandle); sl@0: sl@0: /** sl@0: @deprecated Use RProcess::SecureId() instead sl@0: */ sl@0: inline TUid Identity() const { return SecureId(); } sl@0: sl@0: /** sl@0: Legacy Platform Security development and migration support sl@0: @internalAll sl@0: @deprecated No replacement sl@0: */ sl@0: enum TSecureApi { ESecureApiOff, ESecureApiOn, ESecureApiQuery }; // __SECURE_API__ remove this sl@0: sl@0: /** sl@0: Legacy Platform Security development and migration support sl@0: @internalAll sl@0: @deprecated No replacement sl@0: */ sl@0: IMPORT_C TInt SecureApi(TInt aState); // __SECURE_API__ remove this sl@0: sl@0: /** sl@0: Legacy Platform Security development and migration support sl@0: @internalAll sl@0: @deprecated No replacement sl@0: */ sl@0: enum TDataCaging { EDataCagingOff, EDataCagingOn, EDataCagingQuery}; // __DATA_CAGING__ __SECURE_API__ remove this sl@0: sl@0: /** sl@0: Legacy Platform Security development and migration support sl@0: @internalAll sl@0: @deprecated No replacement sl@0: */ sl@0: IMPORT_C TInt DataCaging(TInt aState); // __DATA_CAGING__ __SECURE_API__ remove this sl@0: sl@0: sl@0: IMPORT_C TInt CreateWithStackOverride(const TDesC& aFileName,const TDesC& aCommand, const TUidType &aUidType, TInt aMinStackSize, TOwnerType aType); sl@0: sl@0: IMPORT_C static TAny* ExeExportData(void); sl@0: sl@0: private: sl@0: // Implementations of functions with diagnostics sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const; sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability) const; sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic) const; sl@0: IMPORT_C TBool DoHasCapability(TCapability aCapability1, TCapability aCapability2) const; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: class RServer2 : public RHandleBase sl@0: { sl@0: public: sl@0: IMPORT_C TInt CreateGlobal(const TDesC& aName); sl@0: IMPORT_C TInt CreateGlobal(const TDesC& aName, TInt aMode); sl@0: IMPORT_C TInt CreateGlobal(const TDesC& aName, TInt aMode, TInt aRole, TInt aOpts); sl@0: IMPORT_C void Receive(RMessage2& aMessage,TRequestStatus& aStatus); sl@0: IMPORT_C void Receive(RMessage2& aMessage); sl@0: IMPORT_C void Cancel(); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Client-side handle to a session with a server. sl@0: sl@0: This is the client-side interface through which communication with the server sl@0: is channelled. sl@0: sl@0: Clients normally define and implement a derived class to provide sl@0: a richer interface. sl@0: */ sl@0: class RSessionBase : public RHandleBase sl@0: { sl@0: friend class RSubSessionBase; sl@0: public: sl@0: /** sl@0: Indicates whether or not threads in the process are automatically attached sl@0: to the session when passed as a parameter to the Share() function. sl@0: */ sl@0: enum TAttachMode {EExplicitAttach,EAutoAttach}; sl@0: public: sl@0: /** sl@0: Creates a session that can be shared by other threads in the current sl@0: process. sl@0: sl@0: After calling this function the session object may be used by threads other sl@0: than than the one that created it. sl@0: sl@0: Note that this can only be done with servers that mark their sessions sl@0: as sharable. sl@0: sl@0: @return KErrNone, if the session is successfully shared; sl@0: KErrNoMmemory, if the attempt fails for lack of memory. sl@0: sl@0: @panic KERN-EXEC 23 The session cannot be shared. sl@0: sl@0: @see CServer2 sl@0: @see RSessionBase::ShareProtected() sl@0: @see CServer2::TServerType sl@0: */ sl@0: inline TInt ShareAuto() { return DoShare(EAutoAttach); } sl@0: sl@0: sl@0: /** sl@0: Creates a session handle that can be be passed via IPC to another process sl@0: as well as being shared by other threads in the current process. sl@0: sl@0: After calling this function the session object may be used by threads other sl@0: than than the one that created it. sl@0: sl@0: Note that this can only be done with servers that mark their sessions sl@0: as globally sharable. sl@0: sl@0: @return KErrNone, if the session is successfully shared; sl@0: KErrNoMmemory, if the attempt fails for lack of memory. sl@0: sl@0: @panic KERN-EXEC 23 The session cannot be shared. sl@0: sl@0: @see CServer2 sl@0: @see RSessionBase::ShareAuto() sl@0: @see CServer2::TServerType sl@0: */ sl@0: inline TInt ShareProtected() { return DoShare(EAutoAttach|KCreateProtectedObject); } sl@0: sl@0: sl@0: IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,const TSecurityPolicy& aServerPolicy,TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess); sl@0: IMPORT_C TInt Open(TInt aArgumentIndex, const TSecurityPolicy& aServerPolicy, TOwnerType aType=EOwnerProcess); sl@0: inline TInt SetReturnedHandle(TInt aHandleOrError); sl@0: IMPORT_C TInt SetReturnedHandle(TInt aHandleOrError,const TSecurityPolicy& aServerPolicy); sl@0: protected: sl@0: inline TInt CreateSession(const TDesC& aServer,const TVersion& aVersion); sl@0: IMPORT_C TInt CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots); sl@0: IMPORT_C TInt CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0); sl@0: inline TInt CreateSession(RServer2 aServer,const TVersion& aVersion); sl@0: IMPORT_C TInt CreateSession(RServer2 aServer,const TVersion& aVersion,TInt aAsyncMessageSlots); sl@0: IMPORT_C TInt CreateSession(RServer2 aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0); sl@0: inline static TInt SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle); sl@0: sl@0: /** sl@0: @deprecated Use CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TIpcSessionType aType,const TSecurityPolicy* aPolicy=0, TRequestStatus* aStatus=0); sl@0: */ sl@0: inline TInt CreateSession(const TDesC& aServer,const TVersion& aVersion,TInt aAsyncMessageSlots,TRequestStatus* aStatus) sl@0: { return CreateSession(aServer, aVersion, aAsyncMessageSlots, EIpcSession_Unsharable, (TSecurityPolicy*)0, aStatus); } sl@0: inline TInt Send(TInt aFunction,const TIpcArgs& aArgs) const; sl@0: inline void SendReceive(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const; sl@0: inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; sl@0: inline TInt Send(TInt aFunction) const; sl@0: inline void SendReceive(TInt aFunction,TRequestStatus& aStatus) const; sl@0: inline TInt SendReceive(TInt aFunction) const; sl@0: private: sl@0: IMPORT_C TInt DoSend(TInt aFunction,const TIpcArgs* aArgs) const; sl@0: IMPORT_C void DoSendReceive(TInt aFunction,const TIpcArgs* aArgs,TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt DoSendReceive(TInt aFunction,const TIpcArgs* aArgs) const; sl@0: TInt SendAsync(TInt aFunction,const TIpcArgs* aArgs,TRequestStatus* aStatus) const; sl@0: TInt SendSync(TInt aFunction,const TIpcArgs* aArgs) const; sl@0: IMPORT_C TInt DoShare(TInt aAttachMode); sl@0: TInt DoConnect(const TVersion &aVersion,TRequestStatus* aStatus); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Client-side handle to a sub-session. sl@0: sl@0: It represents a client-side sub-session, and has a corresponding sub-session sl@0: object on the server-side. sl@0: sl@0: Clients normally define and implement a derived class to provide a richer sl@0: interface. In particular, a derived class should: sl@0: sl@0: 1. provide a function to create a new sub-session with the server; sl@0: this should call CreateSubSession(). sl@0: sl@0: 2. provide a function to close the current sub-session; sl@0: this should call CloseSubSession(). sl@0: sl@0: A session must already exist with a server before a client can establish sl@0: any sub-sessions. sl@0: */ sl@0: class RSubSessionBase sl@0: { sl@0: public: sl@0: inline TInt SubSessionHandle() const; sl@0: protected: sl@0: inline RSubSessionBase(); sl@0: IMPORT_C const RSessionBase Session() const; sl@0: inline TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); sl@0: inline TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction); sl@0: IMPORT_C TInt CreateAutoCloseSubSession(RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); sl@0: IMPORT_C void CloseSubSession(TInt aFunction); sl@0: inline TInt Send(TInt aFunction,const TIpcArgs& aArgs) const; sl@0: inline void SendReceive(TInt aFunction,const TIpcArgs& aArgs,TRequestStatus& aStatus) const; sl@0: inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; sl@0: inline TInt Send(TInt aFunction) const; sl@0: inline void SendReceive(TInt aFunction,TRequestStatus& aStatus) const; sl@0: inline TInt SendReceive(TInt aFunction) const; sl@0: private: sl@0: IMPORT_C TInt DoCreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs* aArgs); sl@0: IMPORT_C TInt DoSend(TInt aFunction,const TIpcArgs* aArgs) const; sl@0: IMPORT_C void DoSendReceive(TInt aFunction,const TIpcArgs* aArgs,TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt DoSendReceive(TInt aFunction,const TIpcArgs* aArgs) const; sl@0: TInt DoCreateSubSession(RSessionBase& aSession,TInt aFunction,const TIpcArgs* aArgs, TBool aAutoClose); sl@0: private: sl@0: RSessionBase iSession; sl@0: TInt iSubSessionHandle; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Base class that provides an implementation for the templated sl@0: RRef class. sl@0: sl@0: @see RRef sl@0: */ sl@0: class RRefBase sl@0: { sl@0: public: sl@0: IMPORT_C void Free(); sl@0: protected: sl@0: inline RRefBase(); sl@0: inline RRefBase(const RRefBase& aRef); sl@0: IMPORT_C void DoAlloc(const TAny* aPtr,TInt aSize); sl@0: IMPORT_C void DoAllocL(const TAny* aPtr,TInt aSize); sl@0: IMPORT_C void Copy(const RRefBase& aRef); sl@0: private: sl@0: IMPORT_C void operator=(const RRefBase& aRef); sl@0: protected: sl@0: TInt* iPtr; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Contains, or packages, a copy of an instance of another class. sl@0: sl@0: The template parameter defines the type of the contained object. sl@0: sl@0: The contained object is held in allocated memory, and can be accessed sl@0: through the member selection and dereference operators. sl@0: */ sl@0: template sl@0: class RRef : public RRefBase sl@0: { sl@0: public: sl@0: inline RRef(); sl@0: inline RRef(const RRef& anObject); sl@0: inline void operator=(const RRef& anObject); sl@0: inline T* operator->(); sl@0: inline operator T*(); sl@0: inline void Alloc(const T& anObject); sl@0: inline void Alloc(const T& anObject,TInt aSize); sl@0: inline void AllocL(const T& anObject); sl@0: inline void AllocL(const T& anObject,TInt aSize); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a change notifier. sl@0: sl@0: The change notifier itself is a kernel object. sl@0: */ sl@0: class RChangeNotifier : public RHandleBase sl@0: { sl@0: public: sl@0: IMPORT_C TInt Create(); sl@0: IMPORT_C TInt Logon(TRequestStatus& aStatus) const; sl@0: IMPORT_C TInt LogonCancel() const; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Handle to a thread death notifier. sl@0: sl@0: The notifier allows threads to be notified of the death of another thread. sl@0: sl@0: The thread-death notifier itself is a kernel object. sl@0: */ sl@0: class RUndertaker : public RHandleBase sl@0: { sl@0: public: sl@0: IMPORT_C TInt Create(); sl@0: IMPORT_C TInt Logon(TRequestStatus& aStatus,TInt& aThreadHandle) const; sl@0: IMPORT_C TInt LogonCancel() const; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: class HBufC16; sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A handle to a session with the extended notifier server that provides support sl@0: for plug-in notifiers. sl@0: sl@0: The interface allows engines or other low level components sl@0: to communicate with the UI. sl@0: */ sl@0: class RNotifier : public RSessionBase sl@0: { sl@0: public: sl@0: IMPORT_C RNotifier(); sl@0: IMPORT_C TInt Connect(); sl@0: IMPORT_C void Close(); sl@0: IMPORT_C TInt StartNotifier(TUid aNotifierUid,const TDesC8& aBuffer); sl@0: IMPORT_C TInt StartNotifier(TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); sl@0: IMPORT_C TInt StartNotifier(TUid aNotifierDllUid,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); sl@0: IMPORT_C TInt CancelNotifier(TUid aNotifierUid); sl@0: IMPORT_C TInt UpdateNotifier(TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); sl@0: IMPORT_C void UpdateNotifierAndGetResponse(TRequestStatus& aRs,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); sl@0: IMPORT_C void StartNotifierAndGetResponse(TRequestStatus& aRs,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); sl@0: IMPORT_C void StartNotifierAndGetResponse(TRequestStatus& aRs,TUid aNotifierDllUid,TUid aNotifierUid,const TDesC8& aBuffer,TDes8& aResponse); sl@0: IMPORT_C TInt UnloadNotifiers(TUid aNotifierUid); sl@0: IMPORT_C TInt LoadNotifiers(TUid aNotifierUid); sl@0: IMPORT_C void Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aBut1,const TDesC& aBut2,TInt& aButtonVal,TRequestStatus& aStatus); sl@0: IMPORT_C void NotifyCancel(); sl@0: IMPORT_C TInt InfoPrint(const TDesC& aDes); sl@0: private: sl@0: TPtr8 iButtonVal; sl@0: HBufC16* iCombinedBuffer; sl@0: }; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Abstract class that defines a handler to work with the TRAP mechanism. sl@0: sl@0: Symbian OS provides a trap handler and this class does not normally need to be sl@0: used or accessed directly by applications and third party code. sl@0: */ sl@0: class TTrapHandler sl@0: { sl@0: public: sl@0: IMPORT_C TTrapHandler(); sl@0: sl@0: /** sl@0: Called when a TRAP is invoked. sl@0: */ sl@0: IMPORT_C virtual void Trap()=0; sl@0: sl@0: /** sl@0: Called when a function exits a TRAP without leaving. sl@0: */ sl@0: IMPORT_C virtual void UnTrap()=0; sl@0: sl@0: /** sl@0: Called when a function within a TRAP leaves. sl@0: sl@0: @param aValue The leave value. sl@0: */ sl@0: IMPORT_C virtual void Leave(TInt aValue)=0; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: struct TCollationMethod; // forward declaration sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Contains a set of static functions which perform manipulation of sl@0: data in memory. sl@0: sl@0: The arguments passed to the functions of this class are pointers to memory sl@0: locations and length values. These functions are, therefore, not normally sl@0: used in open code but are suitable for implementing data manipulation for sl@0: other classes. Typically the interface provided by such classes is typesafe sl@0: and hides this direct memory to memory manipulation. sl@0: */ sl@0: class Mem sl@0: { sl@0: public: sl@0: inline static TUint8* Copy(TAny* aTrg, const TAny* aSrc, TInt aLength); sl@0: inline static TUint8* Move(TAny* aTrg, const TAny* aSrc, TInt aLength); sl@0: inline static void Fill(TAny* aTrg, TInt aLength, TChar aChar); sl@0: inline static void FillZ(TAny* aTrg, TInt aLength); sl@0: #ifndef __GCC32__ sl@0: inline static TInt Compare(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); sl@0: #else sl@0: IMPORT_C static TInt Compare(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); sl@0: #endif sl@0: sl@0: IMPORT_C static TInt Compare(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL); sl@0: IMPORT_C static TInt CompareF(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); sl@0: IMPORT_C static TInt CompareF(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL); sl@0: IMPORT_C static TInt CompareC(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL); sl@0: IMPORT_C static TInt CompareC(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL); sl@0: IMPORT_C static TInt CompareC(const TUint16* aLeft, TInt aLeftL, const TUint16* aRight, TInt aRightL, sl@0: TInt aMaxLevel, const TCollationMethod* aCollationMethod); sl@0: IMPORT_C static TInt CollationMethods(); sl@0: IMPORT_C static TUint CollationMethodId(TInt aIndex); sl@0: IMPORT_C static const TCollationMethod* CollationMethodByIndex(TInt aIndex); sl@0: IMPORT_C static const TCollationMethod* CollationMethodById(TUint aId); sl@0: IMPORT_C static const TCollationMethod* GetDefaultMatchingTable(); sl@0: IMPORT_C static void Swap(TAny* aPtr1, TAny* aPtr2, TInt aLength); sl@0: IMPORT_C static void Crc(TUint16& aCrc, const TAny* aPtr, TInt aLength); sl@0: IMPORT_C static void Crc32(TUint32& aCrc, const TAny* aPtr, TInt aLength); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Set of static user functions. sl@0: sl@0: These functions are related to a number of System component APIs. sl@0: sl@0: The majority of the functions are related to either the current thread, or sl@0: its heap. Examples in this category include User::Exit(), which causes the sl@0: thread to terminate, and User::Alloc(), which allocates memory from the current sl@0: thread's heap. sl@0: sl@0: Some of these functions are equivalent to functions in the RThread or RHeap sl@0: classes. In these cases, the User function is a convenient way to access the sl@0: function without first having to get a handle to the current thread. sl@0: sl@0: Functions are also provided to support debugging of memory leaks. These function sl@0: calls can be written explicitly or can be generated using a corresponding sl@0: macro - the advantage of using a macro is that the function call is only sl@0: generated for debug builds. sl@0: sl@0: A final category of functions, which includes User::BinarySearch() and User::QuickSort(), sl@0: are just useful functions which have no other natural home. sl@0: sl@0: @see RThread sl@0: @see RHeap sl@0: */ sl@0: class User : public UserHeap sl@0: { sl@0: public: sl@0: // Execution control sl@0: IMPORT_C static void InitProcess(); /**< @internalComponent */ sl@0: IMPORT_C static void Exit(TInt aReason); sl@0: IMPORT_C static void Panic(const TDesC& aCategory,TInt aReason); sl@0: IMPORT_C static void HandleException(TAny* aInfo); /**< @internalComponent */ sl@0: // Cleanup support sl@0: IMPORT_C static void Leave(TInt aReason); sl@0: IMPORT_C static void LeaveNoMemory(); sl@0: IMPORT_C static TInt LeaveIfError(TInt aReason); sl@0: IMPORT_C static TAny* LeaveIfNull(TAny* aPtr); sl@0: inline static const TAny* LeaveIfNull(const TAny* aPtr); sl@0: IMPORT_C static TTrapHandler* SetTrapHandler(TTrapHandler* aHandler); sl@0: IMPORT_C static TTrapHandler* TrapHandler(); sl@0: IMPORT_C static TTrapHandler* MarkCleanupStack(); /**< @internalComponent */ sl@0: IMPORT_C static void UnMarkCleanupStack(TTrapHandler* aHandler); /**< @internalComponent */ sl@0: IMPORT_C static void LeaveEnd(); /**< @internalComponent */ sl@0: // Infoprint sl@0: IMPORT_C static TInt InfoPrint(const TDesC& aDes); sl@0: // Asynchronous service support sl@0: IMPORT_C static void RequestComplete(TRequestStatus*& aStatus,TInt aReason); sl@0: IMPORT_C static void WaitForAnyRequest(); sl@0: IMPORT_C static void WaitForRequest(TRequestStatus& aStatus); sl@0: IMPORT_C static void WaitForRequest(TRequestStatus& aStatus1,TRequestStatus& aStatus2); sl@0: IMPORT_C static void WaitForNRequest(TRequestStatus *aStatusArray[], TInt aNum); sl@0: // User heap management sl@0: IMPORT_C static TInt AllocLen(const TAny* aCell); sl@0: IMPORT_C static TAny* Alloc(TInt aSize); sl@0: IMPORT_C static TAny* AllocL(TInt aSize); sl@0: IMPORT_C static TAny* AllocLC(TInt aSize); sl@0: IMPORT_C static TAny* AllocZ(TInt aSize); sl@0: IMPORT_C static TAny* AllocZL(TInt aSize); sl@0: IMPORT_C static TInt AllocSize(TInt& aTotalAllocSize); sl@0: IMPORT_C static TInt Available(TInt& aBiggestBlock); sl@0: IMPORT_C static TInt CountAllocCells(); sl@0: IMPORT_C static TInt CountAllocCells(TInt& aFreeCount); sl@0: IMPORT_C static void Free(TAny* aCell); sl@0: IMPORT_C static void FreeZ(TAny*& aCell); sl@0: IMPORT_C static RAllocator& Allocator(); sl@0: inline static RHeap& Heap(); sl@0: IMPORT_C static TAny* ReAlloc(TAny* aCell, TInt aSize, TInt aMode=0); sl@0: IMPORT_C static TAny* ReAllocL(TAny* aCell, TInt aSize, TInt aMode=0); sl@0: IMPORT_C static RAllocator* SwitchAllocator(RAllocator* aAllocator); sl@0: inline static RHeap* SwitchHeap(RAllocator* aHeap); sl@0: IMPORT_C static TInt CompressAllHeaps(); sl@0: // Synchronous timer services sl@0: IMPORT_C static void After(TTimeIntervalMicroSeconds32 aInterval); sl@0: IMPORT_C static TInt At(const TTime& aTime); sl@0: IMPORT_C static void AfterHighRes(TTimeIntervalMicroSeconds32 aInterval); sl@0: // Set time and deal with timezones sl@0: IMPORT_C static TInt SetHomeTime(const TTime& aTime); sl@0: IMPORT_C static TInt SetHomeTimeSecure(const TTime& aTime); sl@0: IMPORT_C static TInt SetUTCTime(const TTime& aUTCTime); sl@0: IMPORT_C static TInt SetUTCTimeSecure(const TTime& aUTCTime); sl@0: IMPORT_C static TTimeIntervalSeconds UTCOffset(); sl@0: IMPORT_C static void SetUTCOffset(TTimeIntervalSeconds aOffset); sl@0: IMPORT_C static TInt SetUTCTimeAndOffset(const TTime& aUTCTime, TTimeIntervalSeconds aOffset); sl@0: // Set locale information sl@0: IMPORT_C static TInt SetCurrencySymbol(const TDesC& aSymbol); sl@0: // Set floating point mode sl@0: IMPORT_C static TInt SetFloatingPointMode(TFloatingPointMode aMode, TFloatingPointRoundingMode aRoundingMode=EFpRoundToNearest); sl@0: // Timers sl@0: IMPORT_C static TUint TickCount(); sl@0: IMPORT_C static TUint32 NTickCount(); sl@0: IMPORT_C static TTimerLockSpec LockPeriod(); sl@0: IMPORT_C static TTimeIntervalSeconds InactivityTime(); sl@0: IMPORT_C static void ResetInactivityTime(); sl@0: IMPORT_C static TUint32 FastCounter(); sl@0: // Atomic operations sl@0: IMPORT_C static TInt LockedInc(TInt& aValue); sl@0: IMPORT_C static TInt LockedDec(TInt& aValue); sl@0: IMPORT_C static TInt SafeInc(TInt& aValue); sl@0: IMPORT_C static TInt SafeDec(TInt& aValue); sl@0: // Beep sl@0: IMPORT_C static TInt Beep(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration); sl@0: // Information sl@0: IMPORT_C static TInt IsRomAddress(TBool& aBool,TAny* aPtr); sl@0: // Algorithms sl@0: IMPORT_C static TInt BinarySearch(TInt aCount,const TKey& aKey,TInt& aPos); sl@0: IMPORT_C static TInt QuickSort(TInt aCount,const TKey& aKey,const TSwap& aSwap); sl@0: // Language-dependent character functions sl@0: IMPORT_C static TLanguage Language(); sl@0: IMPORT_C static TRegionCode RegionCode(); sl@0: IMPORT_C static TUint Collate(TUint aChar); sl@0: IMPORT_C static TUint Fold(TUint aChar); sl@0: IMPORT_C static TUint LowerCase(TUint aChar); sl@0: IMPORT_C static TUint UpperCase(TUint aChar); sl@0: IMPORT_C static TUint Fold(TUint aChar,TInt aFlags); sl@0: IMPORT_C static TUint TitleCase(TUint aChar); sl@0: // C-style string length sl@0: IMPORT_C static TInt StringLength(const TUint8* aString); sl@0: IMPORT_C static TInt StringLength(const TUint16* aString); sl@0: // Device management sl@0: IMPORT_C static TInt FreeLogicalDevice(const TDesC& aDeviceName); sl@0: IMPORT_C static TInt FreePhysicalDevice(const TDesC& aDriverName); sl@0: IMPORT_C static TInt LoadLogicalDevice(const TDesC& aFileName); sl@0: IMPORT_C static TInt LoadPhysicalDevice(const TDesC& aFileName); sl@0: // Version information sl@0: IMPORT_C static TBool QueryVersionSupported(const TVersion& aCurrent,const TVersion& aRequested); sl@0: IMPORT_C static TVersion Version(); sl@0: // Machine configuration sl@0: IMPORT_C static TInt SetMachineConfiguration(const TDesC8& aConfig); sl@0: IMPORT_C static TInt MachineConfiguration(TDes8& aConfig,TInt& aSize); sl@0: // Debugging support sl@0: IMPORT_C static void SetDebugMask(TUint32 aVal); sl@0: IMPORT_C static void SetDebugMask(TUint32 aVal, TUint aIndex); sl@0: IMPORT_C static void SetJustInTime(const TBool aBoolean); sl@0: IMPORT_C static void Check(); sl@0: IMPORT_C static void Invariant(); sl@0: IMPORT_C static TBool JustInTime(); sl@0: IMPORT_C static void __DbgMarkStart(TBool aKernel); sl@0: IMPORT_C static void __DbgMarkCheck(TBool aKernel, TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum); sl@0: IMPORT_C static TUint32 __DbgMarkEnd(TBool aKernel, TInt aCount); sl@0: IMPORT_C static void __DbgSetAllocFail(TBool aKernel, RAllocator::TAllocFail aFail, TInt aRate); sl@0: IMPORT_C static void __DbgSetBurstAllocFail(TBool aKernel, RAllocator::TAllocFail aFail, TUint aRate, TUint aBurst); sl@0: IMPORT_C static TUint __DbgCheckFailure(TBool aKernel); sl@0: IMPORT_C static void PanicUnexpectedLeave(); /**< @internalComponent */ sl@0: // Name Validation sl@0: IMPORT_C static TInt ValidateName(const TDesC& aName); sl@0: // Instruction Memory Barrier sl@0: IMPORT_C static void IMB_Range(TAny* aStart, TAny* aEnd); sl@0: // sl@0: IMPORT_C static TInt CommandLineLength(); sl@0: IMPORT_C static void CommandLine(TDes &aCommand); sl@0: IMPORT_C static TExceptionHandler ExceptionHandler(); sl@0: IMPORT_C static TInt SetExceptionHandler(TExceptionHandler aHandler,TUint32 aMask); sl@0: IMPORT_C static void ModifyExceptionMask(TUint32 aClearMask, TUint32 aSetMask); sl@0: IMPORT_C static TInt RaiseException(TExcType aType); sl@0: IMPORT_C static TBool IsExceptionHandled(TExcType aType); sl@0: sl@0: /** sl@0: A set of values that defines the effect that terminating a thread sl@0: has, either on its owning process or on the whole system. sl@0: sl@0: A thread is said to be critical if its owning process or the entire system sl@0: terminates when the thread itself terminates. sl@0: sl@0: You pass one of these values to the functions: sl@0: - User::SetCritical() sl@0: - User::SetProcessCritical() sl@0: sl@0: The meaning of a value when passed to one function is different to sl@0: its meaning when passed the other function. See the description of each sl@0: individual value. sl@0: sl@0: @see User::SetCritical() sl@0: @see User::SetProcessCritical() sl@0: */ sl@0: enum TCritical { sl@0: sl@0: sl@0: /** sl@0: This value can be passed to both: sl@0: - User::SetCritical(), which means that the current thread sl@0: is no longer critical, i.e. termination of the current sl@0: thread will no longer cause termination of the current thread's sl@0: owning process (i.e. the current process) or a reboot of the system. sl@0: - User::SetProcessCritical(), which means that threads sl@0: subsequently created in the current thread's owning sl@0: process (i.e. the current process) will no longer cause termination of that sl@0: process or a reboot of the system. Note, however, that existing sl@0: threads are NOT affected when you call this function. sl@0: sl@0: @see User::SetCritical() sl@0: @see User::SetProcessCritical() sl@0: */ sl@0: ENotCritical, sl@0: sl@0: sl@0: /** sl@0: This value can only be passed to User::SetCritical() and sl@0: affects the current thread only. sl@0: sl@0: It means that the owning process (i.e.the current process) sl@0: terminates if: sl@0: - the current thread is terminated. sl@0: - the current thread panics. sl@0: sl@0: @see User::SetCritical() sl@0: */ sl@0: EProcessCritical, sl@0: sl@0: sl@0: /** sl@0: This value can only be passed to User::SetCritical() and sl@0: affects the current thread only. sl@0: sl@0: It means that the owning process (i.e.the current process) sl@0: terminates if the current thread terminates for any reason. sl@0: sl@0: @see User::SetCritical() sl@0: */ sl@0: EProcessPermanent, sl@0: sl@0: sl@0: /** sl@0: This value can only be passed to User::SetProcessCritical() and sl@0: affects any new threads created in the current process. sl@0: sl@0: It means that the current process terminates if: sl@0: - any new thread subsequently created in the current process is terminated. sl@0: - any new thread subsequently created in the current process panics. sl@0: . sl@0: Note, however, that existing threads in the current process sl@0: are NOT affected when you call User::SetProcessCritical() sl@0: with this value. sl@0: sl@0: @see EProcessCritical sl@0: @see User::SetProcessCritical() sl@0: */ sl@0: EAllThreadsCritical, sl@0: sl@0: sl@0: /** sl@0: This value can be passed to both: User::SetCritical() and sl@0: User::SetProcessCritical(). sl@0: sl@0: When passed to User::SetCritical(), it means that sl@0: the entire system is rebooted if: sl@0: - the current thread is terminated. sl@0: - the current thread panics. sl@0: sl@0: When passed to User::SetProcessCritical(), it means that sl@0: the entire system is rebooted if: sl@0: - any new thread subsequently created in the current process is terminated. sl@0: - any new thread subsequently created in the current process panics. sl@0: - the process itself is terminated sl@0: - the process itself panics sl@0: sl@0: Note: sl@0: -# existing threads in the current process are NOT affected when you sl@0: call User::SetProcessCritical() with this value. sl@0: -# Only a process with 'Protected Server' capability can set a sl@0: thread to system-critical. sl@0: sl@0: @see User::SetCritical() sl@0: @see User::SetProcessCritical() sl@0: */ sl@0: ESystemCritical, sl@0: sl@0: sl@0: /** sl@0: This value can be passed to both: User::SetCritical() sl@0: and User::SetProcessCritical(). sl@0: sl@0: When passed to User::SetCritical(), it means that sl@0: the entire system is rebooted if the current thread sl@0: exits for any reason. sl@0: sl@0: When passed to User::SetProcessCritical(), it means that sl@0: the entire system is rebooted if any new thread sl@0: subsequently created in the current process exits sl@0: for any reason, or if the process itself exits for any reason. sl@0: sl@0: Note: sl@0: -# existing threads in the current process are NOT affected when you sl@0: call User::SetProcessCritical() with this value. sl@0: -# Only a process with 'Protected Server' capability can set a sl@0: thread to system-permanent. sl@0: sl@0: @see User::SetCritical() sl@0: @see User::SetProcessCritical() sl@0: */ sl@0: ESystemPermanent sl@0: }; sl@0: IMPORT_C static TCritical Critical(); sl@0: IMPORT_C static TCritical Critical(RThread aThread); sl@0: IMPORT_C static TInt SetCritical(TCritical aCritical); sl@0: IMPORT_C static TCritical ProcessCritical(); sl@0: IMPORT_C static TCritical ProcessCritical(RProcess aProcess); sl@0: IMPORT_C static TInt SetProcessCritical(TCritical aCritical); sl@0: IMPORT_C static TBool PriorityControl(); sl@0: IMPORT_C static void SetPriorityControl(TBool aEnable); sl@0: sl@0: /** sl@0: A threads realtime state. sl@0: Some non-realtime behaviour can be detected by the kernel. When it does so, sl@0: action is taken depending on the thread state: sl@0: - ERealtimeStateOff - no action. sl@0: - ERealtimeStateOn - the the thread will be panicked with KERN-EXEC 61 (EIllegalFunctionForRealtimeThread). sl@0: - ERealtimeStateWarn - no action. However, if the kernel trace flag KREALTIME is enabled sl@0: then tracing will be emitted as if the thread state was ERealtimeStateOn. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: enum TRealtimeState sl@0: { sl@0: ERealtimeStateOff, /**< Thread is not realtime */ sl@0: ERealtimeStateOn, /**< Thread is realtime */ sl@0: ERealtimeStateWarn /**< Thread is realtime but doesn't want this enforced */ sl@0: }; sl@0: sl@0: /** sl@0: Set the current threads realtime state. sl@0: @see TRealtimeState sl@0: @param aState The state sl@0: @return KErrNone if successful. KErrArgument if aState is invalid. sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: IMPORT_C static TInt SetRealtimeState(TRealtimeState aState); sl@0: sl@0: /** sl@0: Return the Secure ID of the process that created the current process. sl@0: @return The Secure ID. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: IMPORT_C static TSecureId CreatorSecureId(); sl@0: sl@0: /** sl@0: Return the Vendor ID of the process that created the current process. sl@0: @return The Vendor ID. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: IMPORT_C static TVendorId CreatorVendorId(); sl@0: sl@0: /** sl@0: Check if the process that created the current process has a given capability sl@0: sl@0: When a check fails the action taken is determined by the system wide Platform Security sl@0: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. sl@0: If PlatSecEnforcement is OFF, then this function will return ETrue even though the sl@0: check failed. sl@0: sl@0: @param aCapability The capability to test. sl@0: @param aDiagnostic A string that will be emitted along with any diagnostic message sl@0: that may be issued if the test finds the capability is not present. sl@0: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro sl@0: which enables it to be easily removed from the system. sl@0: @return ETrue if the creator process has the capability, EFalse otherwise. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: inline static TBool CreatorHasCapability(TCapability aCapability, const char* aDiagnostic=0); sl@0: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: // Only available to NULL arguments sl@0: inline static TBool CreatorHasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL); sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: // For things using KSuppressPlatSecDiagnostic sl@0: inline static TBool CreatorHasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress); sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: sl@0: /** sl@0: Check if the process that created the current process has both of the given capabilities sl@0: sl@0: When a check fails the action taken is determined by the system wide Platform Security sl@0: configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted. sl@0: If PlatSecEnforcement is OFF, then this function will return ETrue even though the sl@0: check failed. sl@0: sl@0: @param aCapability1 The first capability to test. sl@0: @param aCapability2 The second capability to test. sl@0: @param aDiagnostic A string that will be emitted along with any diagnostic message sl@0: that may be issued if the test finds a capability is not present. sl@0: This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro sl@0: which enables it to be easily removed from the system. sl@0: @return ETrue if the creator process has both the capabilities, EFalse otherwise. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: inline static TBool CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0); sl@0: #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: // Only available to NULL arguments sl@0: inline static TBool CreatorHasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL); sl@0: #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: // For things using KSuppressPlatSecDiagnostic sl@0: inline static TBool CreatorHasCapability(TCapability aCapability, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress); sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ sl@0: #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ sl@0: sl@0: IMPORT_C static TInt ParameterLength(TInt aSlot); sl@0: IMPORT_C static TInt GetTIntParameter(TInt aSlot, TInt& aData); sl@0: IMPORT_C static TInt GetDesParameter(TInt aSlot, TDes8& aDes); sl@0: IMPORT_C static TInt GetDesParameter(TInt aSlot, TDes16& aDes); sl@0: IMPORT_C static TInt RenameThread(const TDesC &aName); sl@0: IMPORT_C static TInt RenameProcess(const TDesC &aName); sl@0: /* sl@0: User::Identity() has been deprecated and is available for backward sl@0: compatibility purposes only. sl@0: sl@0: Use RProcess().SecureId() instead. sl@0: sl@0: @deprecated sl@0: */ sl@0: inline static TUid Identity() { return RProcess().SecureId(); } sl@0: sl@0: /* sl@0: User::CreatorIdentity() has been deprecated and is available for backward sl@0: compatibility purposes only. sl@0: sl@0: Use CreatorSecureId() instead. sl@0: sl@0: @deprecated sl@0: */ sl@0: static inline TUid CreatorIdentity() { return CreatorSecureId(); } sl@0: sl@0: IMPORT_C static void NotifyOnIdle(TRequestStatus& aStatus); /**< @internalTechnology */ sl@0: IMPORT_C static void CancelMiscNotifier(TRequestStatus& aStatus); /**< @internalTechnology */ sl@0: private: sl@0: // Implementations of functions with diagnostics sl@0: IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability, const char* aDiagnostic); sl@0: IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability); sl@0: IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic); sl@0: IMPORT_C static TBool DoCreatorHasCapability(TCapability aCapability1, TCapability aCapability2); sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: class ExecHandler; sl@0: sl@0: /** sl@0: @internalComponent sl@0: @removed sl@0: */ sl@0: typedef void (*TTlsCleanupHandler)(TAny*); //don't use sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A collection of static functions involved in managing access to sl@0: thread-local storage. sl@0: sl@0: Thread-local storage is a single machine word of static writable memory. sl@0: The scope of this machine word is the thread, which means that there is one sl@0: word per thread. The word is only accessible to code running in a DLL. sl@0: sl@0: In practice, this word is almost always used to hold a pointer to allocated sl@0: memory; this makes that memory available to all DLL code running on behalf sl@0: of the same thread. sl@0: sl@0: Note that DLL code running on behalf of one thread does not see the same word when sl@0: running on behalf of another thread. sl@0: sl@0: The class in not intended for user derivation. sl@0: */ sl@0: class Dll sl@0: { sl@0: public: sl@0: static TInt SetTls(TAny* aPtr); sl@0: static TAny* Tls(); sl@0: static void FreeTls(); sl@0: static void FileName(TFileName &aFileName); sl@0: }; sl@0: sl@0: sl@0: sl@0: //SL: sl@0: //#ifndef __TOOLS__ sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A thin wrapper class for C++ arrays allowing automatic checking of index values sl@0: to ensure that all accesses are legal. sl@0: sl@0: The class also supports the deletion of objects. sl@0: sl@0: The class is templated, based on a class type and an integer value. The class sl@0: type defines the type of object contained in the array; the integer value sl@0: defines the size (dimension) of the array. sl@0: sl@0: A wrapper object can be: sl@0: sl@0: 1. embedded in objects allocated on the heap. sl@0: sl@0: 2. used on the program stack. sl@0: */ sl@0: template sl@0: class TFixedArray sl@0: { sl@0: typedef TFixedArray ThisClass; sl@0: public: sl@0: inline TFixedArray(); sl@0: inline TFixedArray(const T* aList, TInt aLength); sl@0: // sl@0: inline void Copy(const T* aList, TInt aLength); sl@0: inline void Reset(); // zero fill sl@0: inline void DeleteAll(); sl@0: // sl@0: inline TInt Count() const; sl@0: inline TInt Length() const; sl@0: // Accessors - debug range checking sl@0: inline T& operator[](TInt aIndex); sl@0: inline const T& operator[] (TInt aIndex) const; sl@0: // Accessors - always range checking sl@0: inline T& At(TInt aIndex); sl@0: inline const T& At(TInt aIndex) const; sl@0: // Provides pointers to the beginning and end of the array sl@0: inline T* Begin(); sl@0: inline T* End(); sl@0: inline const T* Begin() const; sl@0: inline const T* End() const; sl@0: // sl@0: inline TArray Array() const; sl@0: protected: sl@0: inline static TBool InRange(TInt aIndex); sl@0: inline static TInt CountFunctionR(const CBase* aThis); sl@0: inline static const TAny* AtFunctionR(const CBase* aThis,TInt aIndex); sl@0: protected: sl@0: T iRep[S]; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #define DECLARE_ROM_ARRAY( AName, AData, AType ) \ sl@0: const TFixedArray& \ sl@0: AName = *(reinterpret_cast* > (AData)) sl@0: //#endif sl@0: sl@0: // Global leaving operator new sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: inline TAny* operator new(TUint aSize, TLeave); sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: inline TAny* operator new(TUint aSize, TLeave, TUint aExtraSize); sl@0: #if !defined(__VC32__) || defined (__MSVCDOTNET__) sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: inline TAny* operator new[](TUint aSize, TLeave); sl@0: #endif sl@0: sl@0: sl@0: #ifdef __LEAVE_EQUALS_THROW__ sl@0: /** Macro to assert in all builds that code does not leave sl@0: sl@0: @param _s C++ statements to be executed which should not leave sl@0: @panic USER 194 if the code being checked does leave sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #define __ASSERT_ALWAYS_NO_LEAVE(_s) \ sl@0: { \ sl@0: try { \ sl@0: TTrapHandler* ____t = User::MarkCleanupStack(); \ sl@0: _s; \ sl@0: User::UnMarkCleanupStack(____t); \ sl@0: } \ sl@0: catch (XLeaveException& /*l*/) \ sl@0: { \ sl@0: User::PanicUnexpectedLeave(); \ sl@0: } \ sl@0: catch (...) \ sl@0: { \ sl@0: User::Invariant(); \ sl@0: } \ sl@0: } sl@0: sl@0: #else sl@0: /** Macro to assert in all builds that code does not leave sl@0: sl@0: @param _s C++ statements to be executed which should not leave sl@0: @panic USER 194 if the code being checked does leave sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #define __ASSERT_ALWAYS_NO_LEAVE(_s) \ sl@0: { \ sl@0: TInt _r; \ sl@0: TTrap _t; \ sl@0: if (_t.Trap(_r) == 0) \ sl@0: { \ sl@0: _s; \ sl@0: TTrap::UnTrap(); \ sl@0: } \ sl@0: else \ sl@0: User::PanicUnexpectedLeave(); \ sl@0: } sl@0: #endif sl@0: sl@0: /** Macro to assert in debug builds that code does not leave sl@0: sl@0: @param _s C++ statements to be executed which should not leave sl@0: @panic USER 194 if the code being checked does leave sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: #ifdef _DEBUG sl@0: #define __ASSERT_DEBUG_NO_LEAVE(_s) __ASSERT_ALWAYS_NO_LEAVE(_s) sl@0: #else sl@0: #define __ASSERT_DEBUG_NO_LEAVE(_s) { _s; } sl@0: #endif sl@0: sl@0: sl@0: sl@0: // Inline methods sl@0: #include sl@0: sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: #endif sl@0: