contentmgmt/contentaccessfwfordrm/source/reccaf/CafApaRecognizer.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalComponent
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef __CAFAPARECOGNIZER_H__
       
    28 #define __CAFAPARECOGNIZER_H__
       
    29 
       
    30 #include <apmrec.h>
       
    31 
       
    32 #include "caf.h"
       
    33 
       
    34 const TUid KUidCafApaRecognizer = {0x101ff761};
       
    35 
       
    36 class CMimeTypeMapping;
       
    37 class RFileReadStream;
       
    38 
       
    39 /**
       
    40 This is the apparc recognizer for files handled by the Content Access Framework.
       
    41 It recognizes protected content and returns a mime type to apparc based upon a
       
    42 set of rules:
       
    43 
       
    44 @li A file containing one or more content object(s) that needs to be be passed 
       
    45 through the CAF supplier API before it can be used will be recognized as it's 
       
    46 native file mime type (eg. application/vnd.oma.drm.message).
       
    47 
       
    48 @li A file containing more than one content object will be recognized as 
       
    49 <b>application/x-caf</b> regardless of what type of file it is. If the file 
       
    50 is recognized the method used to store the content objects inside the file 
       
    51 is irrelevant. CAF abstracts the process of navigating and reading from those 
       
    52 objects anyway.
       
    53 
       
    54 @li A file containing a single content object will be recognized as a mangled 
       
    55 version of that content object's mime type regardless of the type of file holding
       
    56 that content object. The prefix "x-caf-" will be added to the content objects mime 
       
    57 type to distinguish it from normal content files with that mime type. For instance 
       
    58 a protected file containing an image/jpeg will be recognized as x-caf-image/jpeg
       
    59 
       
    60 @internalComponent
       
    61 @released
       
    62 */
       
    63 
       
    64 class CApaCafRecognizer : public CApaDataRecognizerType
       
    65 	{
       
    66 public:	
       
    67 	static CApaCafRecognizer* NewL();
       
    68 	virtual ~CApaCafRecognizer();
       
    69 
       
    70 	// From CApaDataRecognizerType
       
    71 	virtual TUint PreferredBufSize();
       
    72 	virtual TDataType SupportedDataTypeL(TInt aIndex) const;
       
    73 	virtual void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
       
    74 	
       
    75 private:	
       
    76 	CApaCafRecognizer();
       
    77 	void ConstructL();
       
    78 
       
    79 	// Build a list of content types
       
    80 	void SetupContentTypesL();
       
    81 	TInt ReadLine(RFileReadStream& aFile, TDes8& aBuffer);
       
    82 	RPointerArray <CMimeTypeMapping> iContentTypes;
       
    83 
       
    84 	ContentAccess::CAgentResolver* iResolver;
       
    85 	};
       
    86 
       
    87 #endif