First public contribution.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "mmfcontrollerframeworkbase.h"
20 EXPORT_C TMMFEvent::TMMFEvent(TUid aEventType, TInt aErrorCode)
21 : iEventType(aEventType), iErrorCode(aErrorCode)
25 EXPORT_C TMMFEvent::TMMFEvent()
26 : iEventType(KNullUid), iErrorCode(KErrNone)
32 EXPORT_C CMMFMetaDataEntry* CMMFMetaDataEntry::NewL(const TDesC& aName, const TDesC& aValue)
34 CMMFMetaDataEntry* s = new(ELeave) CMMFMetaDataEntry;
35 CleanupStack::PushL(s);
36 s->ConstructL(aName, aValue);
41 EXPORT_C CMMFMetaDataEntry* CMMFMetaDataEntry::NewL(const CMMFMetaDataEntry& aOther)
43 CMMFMetaDataEntry* s = new(ELeave) CMMFMetaDataEntry;
44 CleanupStack::PushL(s);
45 s->ConstructL(aOther.Name(), aOther.Value());
50 EXPORT_C CMMFMetaDataEntry* CMMFMetaDataEntry::NewL()
52 CMMFMetaDataEntry* s = new(ELeave) CMMFMetaDataEntry;
53 CleanupStack::PushL(s);
54 s->ConstructL(KNullDesC, KNullDesC);
59 CMMFMetaDataEntry::CMMFMetaDataEntry()
63 void CMMFMetaDataEntry::ConstructL(const TDesC& aName, const TDesC& aValue)
65 iName = aName.AllocL();
66 iValue = aValue.AllocL();
69 EXPORT_C CMMFMetaDataEntry::~CMMFMetaDataEntry()
75 EXPORT_C void CMMFMetaDataEntry::ExternalizeL(RWriteStream& aStream) const
81 EXPORT_C void CMMFMetaDataEntry::InternalizeL(RReadStream& aStream)
85 iName = HBufC::NewL(aStream, KMaxTInt);//Max length of HBuf is taken from stream - KMaxTInt just used as upper limit
89 iValue = HBufC::NewL(aStream, KMaxTInt);
92 EXPORT_C void CMMFMetaDataEntry::SetNameL(const TDesC& aName)
96 iName = aName.AllocL();
99 EXPORT_C void CMMFMetaDataEntry::SetValueL(const TDesC& aValue)
103 iValue = aValue.AllocL();
106 EXPORT_C const TDesC& CMMFMetaDataEntry::Name() const
111 EXPORT_C const TDesC& CMMFMetaDataEntry::Value() const
120 EXPORT_C CMMFUrlParams* CMMFUrlParams::NewL(const TDesC& aUrl, TInt aIAPId)
122 CMMFUrlParams* s = CMMFUrlParams::NewLC(aUrl, aIAPId);
123 CleanupStack::Pop(s);
127 EXPORT_C CMMFUrlParams* CMMFUrlParams::NewLC(const TDesC& aUrl, TInt aIAPId)
129 CMMFUrlParams* s = new(ELeave) CMMFUrlParams;
130 CleanupStack::PushL(s);
131 s->ConstructL(aUrl, aIAPId);
135 EXPORT_C CMMFUrlParams* CMMFUrlParams::NewLC(RReadStream& aStream)
137 CMMFUrlParams* s = new(ELeave) CMMFUrlParams;
138 CleanupStack::PushL(s);
139 s->ConstructL(aStream);
143 EXPORT_C void CMMFUrlParams::ExternalizeL(RWriteStream& aStream) const
145 aStream.WriteInt16L(iUrl->Length());
146 aStream.WriteL(*iUrl);
147 aStream.WriteInt32L(iIAPId);
150 EXPORT_C CBufFlat* CMMFUrlParams::ExternalizeToCBufFlatLC() const
152 CBufFlat* buffer = CBufFlat::NewL(32);
153 CleanupStack::PushL(buffer);
156 CleanupClosePushL(s);
158 CleanupStack::PopAndDestroy();//s
159 // Leave buffer on the CleanupStack
164 CMMFUrlParams::~CMMFUrlParams()
169 CMMFUrlParams::CMMFUrlParams()
173 void CMMFUrlParams::ConstructL(const TDesC& aUrl, TInt aIAPId)
175 iUrl = aUrl.AllocL();
179 void CMMFUrlParams::ConstructL(RReadStream& aStream)
181 TInt size = aStream.ReadInt16L();
182 iUrl = HBufC::NewL(size);
183 TPtr temp (iUrl->Des());
184 aStream.ReadL(temp, size);
185 iIAPId = aStream.ReadInt32L();
188 EXPORT_C const TDesC& CMMFUrlParams::Url() const
193 EXPORT_C TInt CMMFUrlParams::IAPId() const
198 EXPORT_C TBool CMMFUrlParams::UseIAPId() const
200 return (iIAPId != KUseDefaultIap);