sl@0: /* sl@0: * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include "cafutils.h" sl@0: sl@0: using namespace ContentAccess; sl@0: sl@0: EXPORT_C CRightsInfo* CRightsInfo::NewL(RReadStream& aStream) sl@0: { sl@0: CRightsInfo* self = new (ELeave) CRightsInfo; sl@0: CleanupStack::PushL(self); sl@0: self->InternalizeL(aStream); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CRightsInfo* CRightsInfo::NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsType, TRightsStatus aRightsStatus) sl@0: { sl@0: CRightsInfo* self = new (ELeave) CRightsInfo(aRightsType, aRightsStatus); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aDescription, aUniqueId); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CRightsInfo::CRightsInfo() sl@0: { sl@0: } sl@0: sl@0: CRightsInfo::CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus) : sl@0: iRightsType(aRightsType), iRightsStatus(aRightsStatus) sl@0: { sl@0: } sl@0: sl@0: sl@0: CRightsInfo::~CRightsInfo() sl@0: { sl@0: delete iDescription; sl@0: delete iUniqueId; sl@0: } sl@0: sl@0: void CRightsInfo::ConstructL(const TDesC& aDescription, const TDesC& aUniqueId) sl@0: { sl@0: iDescription = aDescription.AllocL(); sl@0: iUniqueId = aUniqueId.AllocL(); sl@0: } sl@0: sl@0: EXPORT_C const TDesC& CRightsInfo::Description() const sl@0: { sl@0: return *iDescription; sl@0: } sl@0: sl@0: EXPORT_C const TDesC& CRightsInfo::UniqueId() const sl@0: { sl@0: return *iUniqueId; sl@0: } sl@0: sl@0: EXPORT_C TInt CRightsInfo::RightsType() const sl@0: { sl@0: return iRightsType; sl@0: } sl@0: sl@0: EXPORT_C TRightsStatus CRightsInfo::RightsStatus() const sl@0: { sl@0: return iRightsStatus; sl@0: } sl@0: sl@0: EXPORT_C void CRightsInfo::ExternalizeL(RWriteStream &aStream) const sl@0: { sl@0: TCafUtils::WriteDescriptor16L(aStream, *iDescription); sl@0: TCafUtils::WriteDescriptor16L(aStream, *iUniqueId); sl@0: aStream.WriteInt32L(iRightsType); sl@0: aStream.WriteInt32L((TInt) iRightsStatus); sl@0: } sl@0: sl@0: void CRightsInfo::InternalizeL(RReadStream& aStream) sl@0: { sl@0: iDescription = TCafUtils::ReadDescriptor16L(aStream); sl@0: iUniqueId = TCafUtils::ReadDescriptor16L(aStream); sl@0: iRightsType = aStream.ReadInt32L(); sl@0: iRightsStatus = (TRightsStatus) aStream.ReadInt32L(); sl@0: }