sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <s32strm.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <caf/rightsinfo.h>
|
sl@0
|
22 |
#include <caf/agent.h>
|
sl@0
|
23 |
#include "cafutils.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
using namespace ContentAccess;
|
sl@0
|
26 |
|
sl@0
|
27 |
EXPORT_C CRightsInfo* CRightsInfo::NewL(RReadStream& aStream)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
CRightsInfo* self = new (ELeave) CRightsInfo;
|
sl@0
|
30 |
CleanupStack::PushL(self);
|
sl@0
|
31 |
self->InternalizeL(aStream);
|
sl@0
|
32 |
CleanupStack::Pop(self);
|
sl@0
|
33 |
return self;
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
EXPORT_C CRightsInfo* CRightsInfo::NewL(const TDesC& aDescription, const TDesC& aUniqueId, TInt aRightsType, TRightsStatus aRightsStatus)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
CRightsInfo* self = new (ELeave) CRightsInfo(aRightsType, aRightsStatus);
|
sl@0
|
39 |
CleanupStack::PushL(self);
|
sl@0
|
40 |
self->ConstructL(aDescription, aUniqueId);
|
sl@0
|
41 |
CleanupStack::Pop(self);
|
sl@0
|
42 |
return self;
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
CRightsInfo::CRightsInfo()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
CRightsInfo::CRightsInfo(TInt aRightsType, TRightsStatus aRightsStatus) :
|
sl@0
|
50 |
iRightsType(aRightsType), iRightsStatus(aRightsStatus)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
CRightsInfo::~CRightsInfo()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
delete iDescription;
|
sl@0
|
58 |
delete iUniqueId;
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
void CRightsInfo::ConstructL(const TDesC& aDescription, const TDesC& aUniqueId)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
iDescription = aDescription.AllocL();
|
sl@0
|
64 |
iUniqueId = aUniqueId.AllocL();
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
EXPORT_C const TDesC& CRightsInfo::Description() const
|
sl@0
|
68 |
{
|
sl@0
|
69 |
return *iDescription;
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
EXPORT_C const TDesC& CRightsInfo::UniqueId() const
|
sl@0
|
73 |
{
|
sl@0
|
74 |
return *iUniqueId;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
EXPORT_C TInt CRightsInfo::RightsType() const
|
sl@0
|
78 |
{
|
sl@0
|
79 |
return iRightsType;
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
EXPORT_C TRightsStatus CRightsInfo::RightsStatus() const
|
sl@0
|
83 |
{
|
sl@0
|
84 |
return iRightsStatus;
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
EXPORT_C void CRightsInfo::ExternalizeL(RWriteStream &aStream) const
|
sl@0
|
88 |
{
|
sl@0
|
89 |
TCafUtils::WriteDescriptor16L(aStream, *iDescription);
|
sl@0
|
90 |
TCafUtils::WriteDescriptor16L(aStream, *iUniqueId);
|
sl@0
|
91 |
aStream.WriteInt32L(iRightsType);
|
sl@0
|
92 |
aStream.WriteInt32L((TInt) iRightsStatus);
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
void CRightsInfo::InternalizeL(RReadStream& aStream)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
iDescription = TCafUtils::ReadDescriptor16L(aStream);
|
sl@0
|
98 |
iUniqueId = TCafUtils::ReadDescriptor16L(aStream);
|
sl@0
|
99 |
iRightsType = aStream.ReadInt32L();
|
sl@0
|
100 |
iRightsStatus = (TRightsStatus) aStream.ReadInt32L();
|
sl@0
|
101 |
}
|