First public contribution.
2 * Copyright (c) 2004-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.
21 #include <caf/rightsinfo.h>
22 #include <caf/agent.h>
25 using namespace ContentAccess;
27 EXPORT_C CRightsInfo* CRightsInfo::NewL(RReadStream& aStream)
29 CRightsInfo* self = new (ELeave) CRightsInfo;
30 CleanupStack::PushL(self);
31 self->InternalizeL(aStream);
32 CleanupStack::Pop(self);
36 EXPORT_C CRightsInfo* CRightsInfo::NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsType, TRightsStatus aRightsStatus)
38 CRightsInfo* self = new (ELeave) CRightsInfo(aRightsType, aRightsStatus);
39 CleanupStack::PushL(self);
40 self->ConstructL(aDescription, aUniqueId);
41 CleanupStack::Pop(self);
45 CRightsInfo::CRightsInfo()
49 CRightsInfo::CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus) :
50 iRightsType(aRightsType), iRightsStatus(aRightsStatus)
55 CRightsInfo::~CRightsInfo()
61 void CRightsInfo::ConstructL(const TDesC& aDescription, const TDesC& aUniqueId)
63 iDescription = aDescription.AllocL();
64 iUniqueId = aUniqueId.AllocL();
67 EXPORT_C const TDesC& CRightsInfo::Description() const
72 EXPORT_C const TDesC& CRightsInfo::UniqueId() const
77 EXPORT_C TInt CRightsInfo::RightsType() const
82 EXPORT_C TRightsStatus CRightsInfo::RightsStatus() const
87 EXPORT_C void CRightsInfo::ExternalizeL(RWriteStream &aStream) const
89 TCafUtils::WriteDescriptor16L(aStream, *iDescription);
90 TCafUtils::WriteDescriptor16L(aStream, *iUniqueId);
91 aStream.WriteInt32L(iRightsType);
92 aStream.WriteInt32L((TInt) iRightsStatus);
95 void CRightsInfo::InternalizeL(RReadStream& aStream)
97 iDescription = TCafUtils::ReadDescriptor16L(aStream);
98 iUniqueId = TCafUtils::ReadDescriptor16L(aStream);
99 iRightsType = aStream.ReadInt32L();
100 iRightsStatus = (TRightsStatus) aStream.ReadInt32L();