First public contribution.
2 * Copyright (c) 2003-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.
25 #ifndef __CAF_ATTRIBUTE_H__
26 #define __CAF_ATTRIBUTE_H__
32 #include <caf/caftypes.h>
35 namespace ContentAccess
42 * Encapsulates the attributes of a piece of content.
44 * These attributes will be required by DRM-aware
45 * applications in order that they can uphold DRM policies in a
46 * well-behaved manner. In general, clients set one or more attributes
47 * in the <i>Query</i> set, make a <i>GetL</i> call, and then
48 * read the agent's reponse from the <i>Response</i> set.
50 * CAttribute is a container for a number of separate
51 * ContentAccess::CBitset objects. These individual bitsets contain:
52 * -# Queries - what the client is interested in knowing.
53 * -# Responses - the answers to the queries.
54 * -# Capabilities - which attributes the system is able to support.
56 * Access to the bitset operations themselves can be achieved via the
57 * ContentAccess::CAttribute::AttributeSetL operation.
62 class CAttribute : public CBase
66 Constructs a new attribute given an agent and file handle.
68 @param aAgentUid The agent Uid
69 @param aFile A file handle
70 @return The new CAttribute.
75 static CAttribute* NewLC(TUid aAgentUid, RFile& aFile);
78 Constructs a new attribute given an agent and content.
80 @param aAgentUid The agent Uid
81 @param aURI The pathname of the target content.
82 @param aShareMode Optional share mode for opening attributes of this content, defaults to EContentShareReadOnly. This parameter has no effect unless the content is a local file on the device.
83 @return The new CAttribute.
88 static CAttribute* NewLC(TUid aAgentUid, const TDesC& aURI, TContentShareMode aShareMode=EContentShareReadOnly);
90 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
92 Constructs a new attribute given an agent and WMDRM header data.
94 @param aAgentUid The agent Uid
95 @param aHeaderData Header data of WMDRM content
96 @return The new CAttribute.
101 static CAttribute* NewLC(TUid aAgentUid, const TDesC8& aHeaderData);
102 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
104 virtual ~CAttribute();
107 * Returns a reference to the query set
109 * The bits of the query-set should be set or cleared prior to the "GetL()"
110 * call to specify which attributes the client is interested in.
112 * @note Set is probably best used inline to access some of the
113 * CBitset operations directly.
115 * // Set EIsProtected in the Query set.
116 * MyAttr->QuerySet(EQuerySet).Set(EIsProtected);
119 * @return A CBitset refererence.
121 IMPORT_C CBitset& QuerySet();
124 * Returns a reference to the response set.
126 * The response set will only be valid after a call to the "GetL()" operation.
128 * @return A CBitset refererence.
130 IMPORT_C const CBitset& ResponseSet() const;
133 * Resets the attribute object completely.
135 IMPORT_C void Reset();
138 * Delivers the attribute object to the relevant agent for
141 * The agent will set or reset the ResponseSet() bits for any QuerySet() bits
144 IMPORT_C void GetL();
147 void ConstructL(TUid aAgentUid, RFile& aFile);
148 void ConstructL(TUid aAgentUid, const TDesC& aURI, TContentShareMode aShareMode=EContentShareReadOnly);
150 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
151 void ConstructL(TUid aAgentUid, const TDesC8& aHeaderData);
152 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
157 /** The real object used to retrieve attributes. */
158 CAgentContent* iAgentContent;
159 CAgentFactory* iAgentFactory;
162 CBitset* iResponseSet;
166 #endif // REMOVE_CAF1
168 #endif // __ATTRIBUTE_H__