contentmgmt/contentaccessfwfordrm/inc/attribute.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2003-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  @deprecated
       
    25 */
       
    26 
       
    27 #ifndef __CAF_ATTRIBUTE_H__
       
    28 #define __CAF_ATTRIBUTE_H__
       
    29 
       
    30 #ifndef REMOVE_CAF1
       
    31 
       
    32 #include <e32base.h>
       
    33 #include <f32file.h>
       
    34 #include <caf/caftypes.h>
       
    35 
       
    36 
       
    37 namespace ContentAccess
       
    38 {
       
    39 	class CAgentContent;
       
    40 	class CAgentFactory;
       
    41 	class CBitset;
       
    42 	
       
    43 	/**
       
    44 	 * Encapsulates the attributes of a piece of content. 
       
    45 	 *
       
    46 	 * These attributes will be required by DRM-aware
       
    47 	 * applications in order that they can uphold DRM policies in a
       
    48 	 * well-behaved manner. In general, clients set one or more attributes
       
    49 	 * in the <i>Query</i> set, make a <i>GetL</i> call, and then
       
    50 	 * read the agent's reponse from the <i>Response</i> set.
       
    51 	 *
       
    52 	 * CAttribute is a container for a number of separate
       
    53 	 * ContentAccess::CBitset objects. These individual bitsets contain:
       
    54 	 * -# Queries - what the client is interested in knowing.
       
    55 	 * -# Responses - the answers to the queries.
       
    56 	 * -# Capabilities - which attributes the system is able to support.
       
    57 	 *
       
    58 	 * Access to the bitset operations themselves can be achieved via the
       
    59 	 * ContentAccess::CAttribute::AttributeSetL operation.
       
    60 	 *
       
    61 	 * @publishedPartner
       
    62 	 * @deprecated 
       
    63 	 */
       
    64 	class CAttribute : public CBase
       
    65 		{
       
    66 	public:
       
    67 		/**
       
    68 		 Constructs a new attribute given an agent and file handle.
       
    69 		 
       
    70 		 @param aAgentUid	The agent Uid
       
    71 		 @param aFile		A file handle 
       
    72 		 @return			The new CAttribute.
       
    73 		 
       
    74 		 @internalComponent
       
    75 		 @released		 
       
    76 		 */
       
    77 		static CAttribute* NewLC(TUid aAgentUid, RFile& aFile);
       
    78 		
       
    79 		/**
       
    80 		 Constructs a new attribute given an agent and content.
       
    81 		 
       
    82 		 @param aAgentUid	The agent Uid
       
    83 		 @param aURI		The pathname of the target content.
       
    84 		 @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.
       
    85 		 @return			The new CAttribute.
       
    86 		 
       
    87 		 @internalComponent
       
    88 		 @released
       
    89 		 */
       
    90 		static CAttribute* NewLC(TUid aAgentUid, const TDesC& aURI, TContentShareMode aShareMode=EContentShareReadOnly);
       
    91 
       
    92 		
       
    93 		virtual ~CAttribute();
       
    94 
       
    95 		/**
       
    96 		 * Returns a reference to the query set
       
    97 		 *
       
    98 		 * The bits of the query-set should be set or cleared prior to the "GetL()" 
       
    99 		 * call to specify which attributes the client is interested in.
       
   100 		 *
       
   101 		 * @note	Set is probably best used inline to access some of the 
       
   102 		 * 			CBitset operations directly.
       
   103 		 * 			@code 
       
   104 		 * 			// Set EIsProtected in the Query set.
       
   105 		 * 			MyAttr->QuerySet(EQuerySet).Set(EIsProtected);
       
   106 		 * 			@endcode
       
   107 		 *
       
   108 		 * @return	A CBitset refererence.
       
   109 		 */
       
   110 		IMPORT_C CBitset& QuerySet();
       
   111 
       
   112 		/**
       
   113 		 * Returns a reference to the response set. 
       
   114 		 * 
       
   115 		 * The response set will only be valid after a call to the "GetL()" operation.
       
   116 		 *
       
   117 		 * @return	A CBitset refererence.
       
   118 		 */
       
   119 		IMPORT_C const CBitset& ResponseSet() const;
       
   120 		
       
   121 		/**
       
   122 		 * Resets the attribute object completely. 
       
   123 		 */ 
       
   124 		IMPORT_C void Reset();
       
   125 		
       
   126 		/**
       
   127 		 * Delivers the attribute object to the relevant agent for
       
   128 		 * querying. 
       
   129 		 * 
       
   130 		 * The agent will set or reset the ResponseSet() bits for any QuerySet() bits 
       
   131 		 * that are set
       
   132 		 */
       
   133 		IMPORT_C void GetL();
       
   134 		
       
   135 	private:
       
   136 		void ConstructL(TUid aAgentUid, RFile& aFile);
       
   137 		void ConstructL(TUid aAgentUid, const TDesC& aURI, TContentShareMode aShareMode=EContentShareReadOnly);
       
   138 		CAttribute();
       
   139 				
       
   140 	private:
       
   141 		/** The real object used to retrieve attributes. */
       
   142 		CAgentContent* iAgentContent;
       
   143 		CAgentFactory* iAgentFactory;
       
   144 
       
   145 		CBitset* iQuerySet;
       
   146 		CBitset* iResponseSet;
       
   147 		};
       
   148 	}
       
   149 
       
   150 #endif // REMOVE_CAF1
       
   151 
       
   152 #endif // __ATTRIBUTE_H__