First public contribution.
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.
26 #ifndef __EMBEDDEDOBJECT_H__
27 #define __EMBEDDEDOBJECT_H__
30 #include <caf/virtualpath.h>
31 #include <caf/caftypes.h>
33 namespace ContentAccess
35 /** Represents a content object embedded within a file
36 The agent defined uniqueId field describes the location of the object within
40 class CEmbeddedObject : public CBase
43 /** Create a new CEmbeddedObject with a different name and uniqueId
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
51 IMPORT_C static CEmbeddedObject* NewL(const TDesC& aUniqueId, const TDesC& aName, const TDesC8& aMimeType, TEmbeddedType aType);
53 /** Create a new CEmbeddedObject where the Name field is the same as the uniqueId
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
60 IMPORT_C static CEmbeddedObject* NewL(const TDesC& aUniqueId, const TDesC8& aMimeType, TEmbeddedType aType);
62 /** Create a new CEmbeddedObject from a stream
64 @param aStream The stream to read the CEmbeddedObject from
65 @return a CEmbeddedObject
67 IMPORT_C static CEmbeddedObject* NewL(RReadStream& aStream);
70 virtual ~CEmbeddedObject();
72 /** The agent defined UniqueId
75 IMPORT_C const TDesC& UniqueId() const;
77 /** User friendly name of the object
78 @return The name of the object
80 IMPORT_C const TDesC& Name() const;
82 /** The type of object
85 IMPORT_C TEmbeddedType Type() const;
87 /** Mime type of the object
88 @return The mime type of the object or KNullDesC8() if this is a container object
90 IMPORT_C const TDesC8& MimeType() const;
92 /** Allow the class write itself out to a stream
94 @param aStream The stream to write to
96 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
99 CEmbeddedObject(TEmbeddedType aType);
100 void ConstructL(const TDesC& aUniqueId, const TDesC& aName, const TDesC8& aMimeType);
102 void InternalizeL(RReadStream& aStream);
108 TBuf8 <KMaxDataTypeLength> iMimeType;
111 } // namespace ContentAccess