williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined (__APMSTD_H__) williamr@2: #define __APMSTD_H__ williamr@2: williamr@2: #if !defined(__E32STD_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KMaxDataTypeLength=256; williamr@2: williamr@2: // classes referenced williamr@2: class RReadStream; williamr@2: class RWriteStream; williamr@2: williamr@2: /** Defines the priority associated with a data type. williamr@2: williamr@2: The priority is used by a device to resolve the current preferred handler williamr@2: of a data type, in the absence of any user preferences. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: typedef TInt32 TDataTypePriority; williamr@2: williamr@2: /** Reserved for future use. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: const TInt32 KDataTypePriorityUserSpecified=KMaxTInt16; williamr@2: williamr@4: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS williamr@2: /** This is a special priority that overrides any user settings. Applications must williamr@2: have EWriteDeviceData to use this priority. If they have not then they will be williamr@2: downgraded to KDataTypePriorityNormal. williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: const TInt32 KDataTypePrioritySystem = 0xFFF9; williamr@2: williamr@4: #endif //SYMBIAN_ENABLE_SPLIT_HEADERS williamr@4: williamr@2: /** Trusted applications may use this priority value to ensure williamr@2: their MIME type associations cannot be overridden by williamr@2: self signed (untrusted) applications. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: const TInt32 KDataTypePriorityTrustedHigh = 0xC000; williamr@2: williamr@2: /** This is Threshold priority for Un-Trusted apps i.e., for the applications which reside williamr@2: in \\private\\10003a3f\\import\\apps and have a SID which is in the unprotected range. This is to avoid Un-Trusted app's claiming for priority higher williamr@2: than the threshold, if they claim for priority higher than the Threshold then it would be williamr@2: reduced to KDataTypeUnTrustedPriorityThreshold. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: const TInt32 KDataTypeUnTrustedPriorityThreshold=KMaxTInt16; williamr@2: williamr@2: /** A priority value associated with a data (MIME) type. Associating an application williamr@2: with a data type at this priority means that this application, and no other, williamr@2: should ever handle the data type. Use sparingly. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: const TInt32 KDataTypePriorityHigh=10000; williamr@2: williamr@2: /** A priority value associated with a data (MIME) type. Associating an application williamr@2: with a data type at this priority means that the data type is the primary williamr@2: type for that application. For example, "text/plain" files for a text editor. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: const TInt32 KDataTypePriorityNormal=0; williamr@2: williamr@2: /** A priority value associated with a data (MIME) type. Associating an application williamr@2: with a data type at this priority means that the data type is a secondary williamr@2: type for that application. For example, "text/plain" files for a web browser. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: const TInt32 KDataTypePriorityLow=-10000; williamr@2: williamr@2: /** A priority value associated with a data (MIME) type. Associating an application williamr@2: with a data type at this priority means that the data type is a last resort williamr@2: for that application. Use sparingly. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataTypeWithPriority */ williamr@2: const TInt32 KDataTypePriorityLastResort=-20000; williamr@2: williamr@2: /** Reserved for future use. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: const TInt32 KDataTypePriorityNotSupported=KMinTInt16; williamr@2: williamr@2: williamr@2: class TDataType williamr@2: /** A data type. williamr@2: williamr@2: The class maintains a string that describes the data type and an associated williamr@2: UID. williamr@2: williamr@2: A data type is also referred to as a MIME type. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TDataType(); williamr@2: IMPORT_C TDataType(const TDataType& aDataType); williamr@2: IMPORT_C TDataType(const TDesC8& aDataType); williamr@2: IMPORT_C TDataType(TUid aUid); williamr@2: // enquiry williamr@2: IMPORT_C TInt operator==(const TDataType& aDataType) const; williamr@2: IMPORT_C TInt operator!=(const TDataType& aDataType) const; williamr@2: IMPORT_C TBool IsNative() const; williamr@2: // williamr@2: IMPORT_C TBuf Des() const; williamr@2: IMPORT_C TPtrC8 Des8() const; williamr@2: IMPORT_C TUid Uid() const; williamr@2: // williamr@2: IMPORT_C void InternalizeL(RReadStream& aReadStream); williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const; williamr@2: private: williamr@2: void ParseDes(); williamr@2: private: williamr@2: TBuf8 iDataType; williamr@2: TUid iUid; williamr@2: }; williamr@4: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: #define KApaAppTypeDes _L8("x-epoc/x-app") williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: _LIT8(KEpocUrlDataTypeHeader, "X-Epoc-Url/"); williamr@2: williamr@4: #endif //SYMBIAN_ENABLE_SPLIT_HEADERS williamr@2: williamr@2: class TDataTypeWithPriority williamr@2: /** A data (MIME) type and a priority value for that data type. williamr@2: williamr@2: The priority is used to resolve the current preferred handler of a data type, williamr@2: in the absence of any user preferences. An AIF file can associate an application williamr@2: with a data (MIME) type that is not native to Symbian OS. A priority value williamr@2: can be specified that allows the device to choose the highest priority application williamr@2: that can handle that data type. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see TDataType williamr@2: @see TDataTypePriority */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TDataTypeWithPriority(); williamr@2: IMPORT_C TDataTypeWithPriority(const TDataType& aDataType, TDataTypePriority aPriority); williamr@2: // williamr@2: IMPORT_C void InternalizeL(RReadStream& aReadStream); williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const; williamr@2: public: williamr@2: /** The data type. */ williamr@2: TDataType iDataType; williamr@2: /** The priority value. */ williamr@2: TDataTypePriority iPriority; williamr@2: }; williamr@2: williamr@2: #endif