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