author | William Roberts <williamr@symbian.org> |
Tue, 16 Mar 2010 16:12:26 +0000 | |
branch | Symbian2 |
changeset 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@2 | 5 |
* under the terms of the License "Eclipse Public License v1.0" |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@2 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: |
williamr@2 | 15 |
* |
williamr@2 | 16 |
*/ |
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
|
williamr@2 | 20 |
|
williamr@2 | 21 |
/** |
williamr@2 | 22 |
@file |
williamr@2 | 23 |
@publishedPartner |
williamr@2 | 24 |
@released |
williamr@2 | 25 |
*/ |
williamr@2 | 26 |
|
williamr@2 | 27 |
|
williamr@2 | 28 |
#ifndef __RIGHTSINFO_H__ |
williamr@2 | 29 |
#define __RIGHTSINFO_H__ |
williamr@2 | 30 |
|
williamr@2 | 31 |
#include <e32base.h> |
williamr@2 | 32 |
#include <caf/caftypes.h> |
williamr@2 | 33 |
|
williamr@2 | 34 |
class RWriteStream; |
williamr@2 | 35 |
class RReadStream; |
williamr@2 | 36 |
|
williamr@2 | 37 |
namespace ContentAccess |
williamr@2 | 38 |
{ |
williamr@2 | 39 |
|
williamr@2 | 40 |
/** Rights class to store a summary description of the rights and a unique |
williamr@2 | 41 |
reference to the rights object within an Agent |
williamr@2 | 42 |
|
williamr@2 | 43 |
@publishedPartner |
williamr@2 | 44 |
@released |
williamr@2 | 45 |
*/ |
williamr@2 | 46 |
class CRightsInfo : public CBase |
williamr@2 | 47 |
{ |
williamr@2 | 48 |
public: |
williamr@2 | 49 |
|
williamr@2 | 50 |
/** Construct a new CRightsInfo |
williamr@2 | 51 |
|
williamr@2 | 52 |
@param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc |
williamr@2 | 53 |
@param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from |
williamr@2 | 54 |
@param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object |
williamr@2 | 55 |
@param aRightsStatus The current status of this rights object |
williamr@2 | 56 |
@return A CRightsInfo object |
williamr@2 | 57 |
*/ |
williamr@2 | 58 |
IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus); |
williamr@2 | 59 |
|
williamr@2 | 60 |
/** Construct a new CRightsInfo from a stream */ |
williamr@2 | 61 |
IMPORT_C static CRightsInfo* NewL(RReadStream& aStream); |
williamr@2 | 62 |
|
williamr@2 | 63 |
virtual ~CRightsInfo(); |
williamr@2 | 64 |
|
williamr@2 | 65 |
/** returns a string describing the rights object |
williamr@2 | 66 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
williamr@2 | 67 |
*/ |
williamr@2 | 68 |
IMPORT_C const TDesC& Description() const; |
williamr@2 | 69 |
|
williamr@2 | 70 |
/** returns a string with a unique Id used to identify a particular rights object |
williamr@2 | 71 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
williamr@2 | 72 |
*/ |
williamr@2 | 73 |
IMPORT_C const TDesC& UniqueId() const; |
williamr@2 | 74 |
|
williamr@2 | 75 |
/** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable |
williamr@2 | 76 |
|
williamr@2 | 77 |
@see ContentAccess::TRightsTypeMask |
williamr@2 | 78 |
|
williamr@2 | 79 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
williamr@2 | 80 |
*/ |
williamr@2 | 81 |
IMPORT_C TInt RightsType() const; |
williamr@2 | 82 |
|
williamr@2 | 83 |
/** The state of the rights |
williamr@2 | 84 |
|
williamr@2 | 85 |
@see ContentAccess::TRightsStatus |
williamr@2 | 86 |
|
williamr@2 | 87 |
@capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
williamr@2 | 88 |
*/ |
williamr@2 | 89 |
IMPORT_C TRightsStatus RightsStatus() const; |
williamr@2 | 90 |
|
williamr@2 | 91 |
/** Write this CRightsInfo object to a stream |
williamr@2 | 92 |
|
williamr@2 | 93 |
@param aStream The stream |
williamr@2 | 94 |
*/ |
williamr@2 | 95 |
IMPORT_C void ExternalizeL(RWriteStream &aStream) const; |
williamr@2 | 96 |
|
williamr@2 | 97 |
private: |
williamr@2 | 98 |
CRightsInfo(); |
williamr@2 | 99 |
|
williamr@2 | 100 |
CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus); |
williamr@2 | 101 |
void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId); |
williamr@2 | 102 |
|
williamr@2 | 103 |
void InternalizeL(RReadStream& aStream); |
williamr@2 | 104 |
|
williamr@2 | 105 |
private: |
williamr@2 | 106 |
|
williamr@2 | 107 |
HBufC* iDescription; |
williamr@2 | 108 |
HBufC* iUniqueId; |
williamr@2 | 109 |
|
williamr@2 | 110 |
TInt iRightsType; |
williamr@2 | 111 |
TRightsStatus iRightsStatus; |
williamr@2 | 112 |
}; |
williamr@2 | 113 |
|
williamr@2 | 114 |
/** Interface used by agents as a base class for their own rights objects |
williamr@2 | 115 |
|
williamr@2 | 116 |
Agent derived classes will contain a complete object capable of describing |
williamr@2 | 117 |
rights for content managed by that agent. |
williamr@2 | 118 |
|
williamr@2 | 119 |
All derived classes must implement the serialization functions InternalizeL() |
williamr@2 | 120 |
and ExternalizeL() |
williamr@2 | 121 |
|
williamr@2 | 122 |
@publishedPartner |
williamr@2 | 123 |
@released |
williamr@2 | 124 |
*/ |
williamr@2 | 125 |
class MAgentRightsBase |
williamr@2 | 126 |
{ |
williamr@2 | 127 |
public: |
williamr@2 | 128 |
virtual void ExternalizeL(RWriteStream& aStream) const = 0; |
williamr@2 | 129 |
virtual void InternalizeL(RReadStream& aStream) = 0; |
williamr@2 | 130 |
}; |
williamr@2 | 131 |
} |
williamr@2 | 132 |
|
williamr@2 | 133 |
#endif |