|
1 /* |
|
2 * Copyright (c) 2004-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 @released |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef __RIGHTSINFO_H__ |
|
29 #define __RIGHTSINFO_H__ |
|
30 |
|
31 #include <e32base.h> |
|
32 #include <caf/caftypes.h> |
|
33 |
|
34 class RWriteStream; |
|
35 class RReadStream; |
|
36 |
|
37 namespace ContentAccess |
|
38 { |
|
39 |
|
40 /** Rights class to store a summary description of the rights and a unique |
|
41 reference to the rights object within an Agent |
|
42 |
|
43 @publishedPartner |
|
44 @released |
|
45 */ |
|
46 class CRightsInfo : public CBase |
|
47 { |
|
48 public: |
|
49 |
|
50 /** Construct a new CRightsInfo |
|
51 |
|
52 @param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc |
|
53 @param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from |
|
54 @param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object |
|
55 @param aRightsStatus The current status of this rights object |
|
56 @return A CRightsInfo object |
|
57 */ |
|
58 IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus); |
|
59 |
|
60 /** Construct a new CRightsInfo from a stream */ |
|
61 IMPORT_C static CRightsInfo* NewL(RReadStream& aStream); |
|
62 |
|
63 virtual ~CRightsInfo(); |
|
64 |
|
65 /** returns a string describing the rights object |
|
66 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
67 */ |
|
68 IMPORT_C const TDesC& Description() const; |
|
69 |
|
70 /** returns a string with a unique Id used to identify a particular rights object |
|
71 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
72 */ |
|
73 IMPORT_C const TDesC& UniqueId() const; |
|
74 |
|
75 /** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable |
|
76 |
|
77 @see ContentAccess::TRightsTypeMask |
|
78 |
|
79 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
80 */ |
|
81 IMPORT_C TInt RightsType() const; |
|
82 |
|
83 /** The state of the rights |
|
84 |
|
85 @see ContentAccess::TRightsStatus |
|
86 |
|
87 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
88 */ |
|
89 IMPORT_C TRightsStatus RightsStatus() const; |
|
90 |
|
91 /** Write this CRightsInfo object to a stream |
|
92 |
|
93 @param aStream The stream |
|
94 */ |
|
95 IMPORT_C void ExternalizeL(RWriteStream &aStream) const; |
|
96 |
|
97 private: |
|
98 CRightsInfo(); |
|
99 |
|
100 CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus); |
|
101 void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId); |
|
102 |
|
103 void InternalizeL(RReadStream& aStream); |
|
104 |
|
105 private: |
|
106 |
|
107 HBufC* iDescription; |
|
108 HBufC* iUniqueId; |
|
109 |
|
110 TInt iRightsType; |
|
111 TRightsStatus iRightsStatus; |
|
112 }; |
|
113 |
|
114 /** Interface used by agents as a base class for their own rights objects |
|
115 |
|
116 Agent derived classes will contain a complete object capable of describing |
|
117 rights for content managed by that agent. |
|
118 |
|
119 All derived classes must implement the serialization functions InternalizeL() |
|
120 and ExternalizeL() |
|
121 |
|
122 @publishedPartner |
|
123 @released |
|
124 */ |
|
125 class MAgentRightsBase |
|
126 { |
|
127 public: |
|
128 virtual void ExternalizeL(RWriteStream& aStream) const = 0; |
|
129 virtual void InternalizeL(RReadStream& aStream) = 0; |
|
130 }; |
|
131 } |
|
132 |
|
133 #endif |