2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
28 #ifndef __EMBEDDEDOBJECT_H__
29 #define __EMBEDDEDOBJECT_H__
32 #include <caf/virtualpath.h>
33 #include <caf/caftypes.h>
35 namespace ContentAccess
37 /** Represents a content object embedded within a file
38 The agent defined uniqueId field describes the location of the object within
44 class CEmbeddedObject : public CBase
47 /** Create a new CEmbeddedObject with a different name and uniqueId
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
55 IMPORT_C static CEmbeddedObject* NewL(const TDesC& aUniqueId, const TDesC& aName, const TDesC8& aMimeType, TEmbeddedType aType);
57 /** Create a new CEmbeddedObject where the Name field is the same as the uniqueId
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
64 IMPORT_C static CEmbeddedObject* NewL(const TDesC& aUniqueId, const TDesC8& aMimeType, TEmbeddedType aType);
66 /** Create a new CEmbeddedObject from a stream
68 @param aStream The stream to read the CEmbeddedObject from
69 @return a CEmbeddedObject
71 IMPORT_C static CEmbeddedObject* NewL(RReadStream& aStream);
74 virtual ~CEmbeddedObject();
76 /** The agent defined UniqueId
79 IMPORT_C const TDesC& UniqueId() const;
81 /** User friendly name of the object
82 @return The name of the object
84 IMPORT_C const TDesC& Name() const;
86 /** The type of object
89 IMPORT_C TEmbeddedType Type() const;
91 /** Mime type of the object
92 @return The mime type of the object or KNullDesC8() if this is a container object
94 IMPORT_C const TDesC8& MimeType() const;
96 /** Allow the class write itself out to a stream
98 @param aStream The stream to write to
100 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
103 CEmbeddedObject(TEmbeddedType aType);
104 void ConstructL(const TDesC& aUniqueId, const TDesC& aName, const TDesC8& aMimeType);
106 void InternalizeL(RReadStream& aStream);
112 TBuf8 <KMaxDataTypeLength> iMimeType;
115 } // namespace ContentAccess