os/security/contentmgmt/contentaccessfwfordrm/inc/EmbeddedObject.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2004-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  @file
    21  @publishedAll
    22  @released
    23 */
    24 
    25 
    26 #ifndef __EMBEDDEDOBJECT_H__
    27 #define __EMBEDDEDOBJECT_H__
    28 
    29 #include <apmstd.h>
    30 #include <caf/virtualpath.h>
    31 #include <caf/caftypes.h>
    32 
    33 namespace ContentAccess
    34 	{
    35 	/** Represents a content object embedded within a file
    36 	The agent defined uniqueId field describes the location of the object within 
    37 	the file.
    38 
    39 	*/
    40 	class CEmbeddedObject : public CBase
    41 		{
    42 	public:
    43 		/** Create a new CEmbeddedObject with a different name and uniqueId
    44 
    45 		@param aUniqueId The UniqueId of the embedded object
    46 		@param aName A user friendly name for the object
    47 		@param aMimeType The mime type of the object (if it not a container object)
    48 		@param aType The type of object (Content, container, agentspecific etc)
    49 		@return a CEmbeddedObject
    50 		*/
    51 		IMPORT_C static CEmbeddedObject* NewL(const TDesC& aUniqueId, const TDesC& aName, const TDesC8& aMimeType, TEmbeddedType aType);
    52 
    53 		/** Create a new CEmbeddedObject where the Name field is the same as the uniqueId
    54 
    55 		@param aUniqueId The UniqueId of the embedded object
    56 		@param aMimeType The mime type of the object (if it not a container object)
    57 		@param aType The type of object (Content, container, agentspecific etc)
    58 		@return a CEmbeddedObject
    59 		*/
    60 		IMPORT_C static CEmbeddedObject* NewL(const TDesC& aUniqueId, const TDesC8& aMimeType, TEmbeddedType aType);
    61 
    62 		/** Create a new CEmbeddedObject from a stream 
    63 
    64 		@param aStream The stream to read the CEmbeddedObject from
    65 		@return a CEmbeddedObject
    66 		*/
    67 		IMPORT_C static CEmbeddedObject* NewL(RReadStream& aStream);
    68 
    69 		/** destructor */
    70 		virtual ~CEmbeddedObject();
    71 
    72 		/** The agent defined UniqueId 
    73 		@return The uniqueId
    74 		*/
    75 		IMPORT_C const TDesC& UniqueId() const;
    76 		
    77 		/** User friendly name of the object 
    78 		@return The name of the object
    79 		*/
    80 		IMPORT_C const TDesC& Name() const;
    81 		
    82 		/** The type of object 
    83 		@return The type
    84 		*/
    85 		IMPORT_C TEmbeddedType Type() const;	
    86 
    87 		/** Mime type of the object
    88 		@return The mime type of the object or KNullDesC8() if this is a container object
    89 		*/
    90 		IMPORT_C const TDesC8& MimeType() const;
    91 
    92 		/** Allow the class write itself out to a stream 
    93 
    94 		@param aStream The stream to write to
    95 		*/ 
    96 		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
    97 
    98 	private:
    99 		CEmbeddedObject(TEmbeddedType aType);
   100 		void ConstructL(const TDesC& aUniqueId, const TDesC& aName, const TDesC8& aMimeType);
   101 
   102 		void InternalizeL(RReadStream& aStream);
   103 
   104 	private:
   105 		TEmbeddedType iType;
   106 		HBufC* iUniqueId;
   107 		HBufC* iName;
   108 		TBuf8 <KMaxDataTypeLength> iMimeType;
   109 		};
   110 
   111 	} // namespace ContentAccess
   112 
   113 #endif