genericservices/mimerecognitionfw/inc/APMSTD.H
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined (__APMSTD_H__)
       
    17 #define __APMSTD_H__
       
    18 
       
    19 #if !defined(__E32STD_H__)
       
    20 #include <e32std.h>
       
    21 #endif
       
    22 
       
    23 /**
       
    24 @publishedAll
       
    25 @released
       
    26 */
       
    27 const TInt KMaxDataTypeLength=256;
       
    28 
       
    29 // classes referenced
       
    30 class RReadStream;
       
    31 class RWriteStream;
       
    32 
       
    33 /** Defines the priority associated with a data type.
       
    34 
       
    35 The priority is used by a device to resolve the current preferred handler 
       
    36 of a data type, in the absence of any user preferences.
       
    37 
       
    38 @publishedAll
       
    39 @released
       
    40 @see TDataTypeWithPriority */
       
    41 typedef TInt32 TDataTypePriority;
       
    42 
       
    43 /** Reserved for future use. 
       
    44 
       
    45 @publishedAll
       
    46 @released */
       
    47 const TInt32 KDataTypePriorityUserSpecified=KMaxTInt16;
       
    48 
       
    49 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    50 /** This is a special priority that overrides any user settings. Applications must
       
    51 have EWriteDeviceData to use this priority. If they have not then they will be
       
    52 downgraded to KDataTypePriorityNormal.
       
    53 
       
    54 @publishedPartner
       
    55 @released
       
    56 @see TDataTypeWithPriority */
       
    57 const TInt32 KDataTypePrioritySystem = 0xFFF9;
       
    58 
       
    59 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
    60 
       
    61 /** Trusted applications may use this priority value to ensure 
       
    62     their MIME type associations cannot be overridden by 
       
    63     self signed (untrusted) applications.
       
    64 
       
    65 @publishedAll
       
    66 @released
       
    67 @see TDataTypeWithPriority */
       
    68 const TInt32 KDataTypePriorityTrustedHigh = 0xC000;
       
    69 
       
    70 /** This is Threshold priority for Un-Trusted apps i.e., for the applications which reside 
       
    71 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 
       
    72 than the threshold, if they claim for priority higher than the Threshold then it would be 
       
    73 reduced to KDataTypeUnTrustedPriorityThreshold.
       
    74 
       
    75 @publishedAll
       
    76 @released */
       
    77 const TInt32 KDataTypeUnTrustedPriorityThreshold=KMaxTInt16;
       
    78 
       
    79 /** A priority value associated with a data (MIME) type. Associating an application 
       
    80 with a data type at this priority means that this application, and no other, 
       
    81 should ever handle the data type. Use sparingly.
       
    82 
       
    83 @publishedAll
       
    84 @released
       
    85 @see TDataTypeWithPriority */
       
    86 const TInt32 KDataTypePriorityHigh=10000;
       
    87 
       
    88 /** A priority value associated with a data (MIME) type. Associating an application 
       
    89 with a data type at this priority means that the data type is the primary 
       
    90 type for that application. For example, "text/plain" files for a text editor.
       
    91 
       
    92 @publishedAll
       
    93 @released
       
    94 @see TDataTypeWithPriority */
       
    95 const TInt32 KDataTypePriorityNormal=0;
       
    96 
       
    97 /** A priority value associated with a data (MIME) type. Associating an application 
       
    98 with a data type at this priority means that the data type is a secondary 
       
    99 type for that application. For example, "text/plain" files for a web browser.
       
   100 
       
   101 @publishedAll
       
   102 @released
       
   103 @see TDataTypeWithPriority */
       
   104 const TInt32 KDataTypePriorityLow=-10000;
       
   105 
       
   106 /** A priority value associated with a data (MIME) type. Associating an application 
       
   107 with a data type at this priority means that the data type is a last resort 
       
   108 for that application. Use sparingly.
       
   109 
       
   110 @publishedAll
       
   111 @released
       
   112 @see TDataTypeWithPriority */
       
   113 const TInt32 KDataTypePriorityLastResort=-20000;
       
   114 
       
   115 /** Reserved for future use. 
       
   116 
       
   117 @publishedAll
       
   118 @released */
       
   119 const TInt32 KDataTypePriorityNotSupported=KMinTInt16;
       
   120 
       
   121 
       
   122 class TDataType
       
   123 /** A data type.
       
   124 
       
   125 The class maintains a string that describes the data type and an associated 
       
   126 UID.
       
   127 
       
   128 A data type is also referred to as a MIME type. 
       
   129 
       
   130 @publishedAll
       
   131 @released */
       
   132 	{
       
   133 public:
       
   134 	IMPORT_C TDataType();
       
   135 	IMPORT_C TDataType(const TDataType& aDataType);
       
   136 	IMPORT_C TDataType(const TDesC8& aDataType);
       
   137 	IMPORT_C TDataType(TUid aUid);
       
   138 	// enquiry
       
   139 	IMPORT_C TInt operator==(const TDataType& aDataType) const;
       
   140 	IMPORT_C TInt operator!=(const TDataType& aDataType) const;
       
   141 	IMPORT_C TBool IsNative() const;
       
   142 	// 
       
   143 	IMPORT_C TBuf<KMaxDataTypeLength> Des() const;
       
   144 	IMPORT_C TPtrC8 Des8() const;
       
   145 	IMPORT_C TUid Uid() const;
       
   146 	//
       
   147 	IMPORT_C void InternalizeL(RReadStream& aReadStream);
       
   148 	IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const;
       
   149 private:
       
   150 	void ParseDes();
       
   151 private:
       
   152 	TBuf8<KMaxDataTypeLength> iDataType;
       
   153 	TUid iUid;
       
   154 	};
       
   155 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   156 /**
       
   157 @internalComponent
       
   158 */
       
   159 #define KApaAppTypeDes _L8("x-epoc/x-app")
       
   160 
       
   161 /**
       
   162 @internalComponent
       
   163 */
       
   164 _LIT8(KEpocUrlDataTypeHeader, "X-Epoc-Url/");
       
   165 
       
   166 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
       
   167 
       
   168 class TDataTypeWithPriority
       
   169 /** A data (MIME) type and a priority value for that data type.
       
   170 
       
   171 The priority is used to resolve the current preferred handler of a data type, 
       
   172 in the absence of any user preferences. An AIF file can associate an application 
       
   173 with a data (MIME) type that is not native to Symbian OS. A priority value 
       
   174 can be specified that allows the device to choose the highest priority application 
       
   175 that can handle that data type.
       
   176 
       
   177 @publishedAll 
       
   178 @released 
       
   179 @see TDataType
       
   180 @see TDataTypePriority */
       
   181 	{
       
   182 public:
       
   183 	IMPORT_C TDataTypeWithPriority();
       
   184 	IMPORT_C TDataTypeWithPriority(const TDataType& aDataType, TDataTypePriority aPriority);
       
   185 	//
       
   186 	IMPORT_C void InternalizeL(RReadStream& aReadStream);
       
   187 	IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const;
       
   188 public:
       
   189 	/** The data type. */
       
   190 	TDataType iDataType;
       
   191 	/** The priority value. */
       
   192 	TDataTypePriority iPriority;
       
   193 	};
       
   194 
       
   195 #endif