1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/caf/rightsinfo.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,133 @@
1.4 +/*
1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 + @publishedPartner
1.27 + @released
1.28 +*/
1.29 +
1.30 +
1.31 +#ifndef __RIGHTSINFO_H__
1.32 +#define __RIGHTSINFO_H__
1.33 +
1.34 +#include <e32base.h>
1.35 +#include <caf/caftypes.h>
1.36 +
1.37 +class RWriteStream;
1.38 +class RReadStream;
1.39 +
1.40 +namespace ContentAccess
1.41 +{
1.42 +
1.43 + /** Rights class to store a summary description of the rights and a unique
1.44 + reference to the rights object within an Agent
1.45 +
1.46 + @publishedPartner
1.47 + @released
1.48 + */
1.49 + class CRightsInfo : public CBase
1.50 + {
1.51 + public:
1.52 +
1.53 + /** Construct a new CRightsInfo
1.54 +
1.55 + @param aDescription A generic text description of the rights supplied by the agent "Content XYZ Expiry date mm/dd/yy" etc
1.56 + @param aUniqueId A uniqueId used to refer to this particular rights object within the agent it came from
1.57 + @param aRightsTypeMask A bitmask of TRightsType entries applicable to this rights object
1.58 + @param aRightsStatus The current status of this rights object
1.59 + @return A CRightsInfo object
1.60 + */
1.61 + IMPORT_C static CRightsInfo* NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsTypeMask, TRightsStatus aRightsStatus);
1.62 +
1.63 + /** Construct a new CRightsInfo from a stream */
1.64 + IMPORT_C static CRightsInfo* NewL(RReadStream& aStream);
1.65 +
1.66 + virtual ~CRightsInfo();
1.67 +
1.68 + /** returns a string describing the rights object
1.69 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.70 + */
1.71 + IMPORT_C const TDesC& Description() const;
1.72 +
1.73 + /** returns a string with a unique Id used to identify a particular rights object
1.74 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.75 + */
1.76 + IMPORT_C const TDesC& UniqueId() const;
1.77 +
1.78 + /** Returns a bit mask of TRightsTypeMask flags. A rights object can be stateless and/or consumable
1.79 +
1.80 + @see ContentAccess::TRightsTypeMask
1.81 +
1.82 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.83 + */
1.84 + IMPORT_C TInt RightsType() const;
1.85 +
1.86 + /** The state of the rights
1.87 +
1.88 + @see ContentAccess::TRightsStatus
1.89 +
1.90 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.91 + */
1.92 + IMPORT_C TRightsStatus RightsStatus() const;
1.93 +
1.94 + /** Write this CRightsInfo object to a stream
1.95 +
1.96 + @param aStream The stream
1.97 + */
1.98 + IMPORT_C void ExternalizeL(RWriteStream &aStream) const;
1.99 +
1.100 + private:
1.101 + CRightsInfo();
1.102 +
1.103 + CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus);
1.104 + void ConstructL(const TDesC& aDescription, const TDesC& aUniqueId);
1.105 +
1.106 + void InternalizeL(RReadStream& aStream);
1.107 +
1.108 + private:
1.109 +
1.110 + HBufC* iDescription;
1.111 + HBufC* iUniqueId;
1.112 +
1.113 + TInt iRightsType;
1.114 + TRightsStatus iRightsStatus;
1.115 + };
1.116 +
1.117 + /** Interface used by agents as a base class for their own rights objects
1.118 +
1.119 + Agent derived classes will contain a complete object capable of describing
1.120 + rights for content managed by that agent.
1.121 +
1.122 + All derived classes must implement the serialization functions InternalizeL()
1.123 + and ExternalizeL()
1.124 +
1.125 + @publishedPartner
1.126 + @released
1.127 + */
1.128 + class MAgentRightsBase
1.129 + {
1.130 + public:
1.131 + virtual void ExternalizeL(RWriteStream& aStream) const = 0;
1.132 + virtual void InternalizeL(RReadStream& aStream) = 0;
1.133 + };
1.134 + }
1.135 +
1.136 +#endif