99
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "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".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
112
|
17 |
#include "afserializer.h"
|
99
|
18 |
#include <s32mem.h>
|
|
19 |
// -----------------------------------------------------------------------------
|
|
20 |
//
|
|
21 |
// -----------------------------------------------------------------------------
|
|
22 |
//
|
|
23 |
RBuf8 &operator <<(RBuf8 &dst, const QVariantHash &src)
|
|
24 |
{
|
|
25 |
QByteArray buffer;
|
|
26 |
QDataStream stream(&buffer, QIODevice::WriteOnly);
|
|
27 |
|
|
28 |
QT_TRYCATCH_LEAVING(stream << src);
|
|
29 |
const int dataLength(buffer.length());
|
|
30 |
const unsigned char *dataPtr(reinterpret_cast<const unsigned char *>(buffer.constData()));
|
|
31 |
if (dst.MaxLength() < dataLength) {
|
|
32 |
dst.ReAllocL(dataLength);
|
|
33 |
}
|
|
34 |
dst.Copy(dataPtr, dataLength);
|
|
35 |
return dst;
|
|
36 |
}
|
|
37 |
|
|
38 |
// -----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
//
|
|
42 |
QVariantHash &operator <<(QVariantHash &dst, const TDesC8 &src)
|
|
43 |
{
|
|
44 |
QByteArray buffer(QByteArray::fromRawData(reinterpret_cast<const char *>(src.Ptr()),
|
|
45 |
src.Length()) );
|
|
46 |
|
|
47 |
QDataStream stream(&buffer, QIODevice::ReadOnly);
|
112
|
48 |
stream >> dst;
|
99
|
49 |
return dst;
|
|
50 |
}
|