equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
24 #include <istream> |
24 #include <istream> |
25 #include <vector> |
25 #include <vector> |
26 #include "serialisable.h" |
26 #include "serialisable.h" |
27 #include "cardinality.h" |
27 #include "cardinality.h" |
28 #include "ucmp.h" |
28 #include "ucmp.h" |
|
29 #include "utf8_wrapper.h" |
|
30 #include "is_utils.h" |
29 |
31 |
30 #pragma warning (disable: 4800) |
32 #pragma warning (disable: 4800) |
31 |
33 |
32 |
34 |
33 /** |
35 /** |
134 } |
136 } |
135 val.assign(buff, size); |
137 val.assign(buff, size); |
136 delete buff; |
138 delete buff; |
137 return *this; |
139 return *this; |
138 } |
140 } |
|
141 |
|
142 #ifdef __TOOLS2_LINUX__ |
|
143 |
|
144 Deserialiser& operator>>(std::wstring& val) |
|
145 { |
|
146 Cardinality card; |
|
147 *this >> card; |
|
148 TUint32 size = card; |
|
149 |
|
150 TUint32 sizebackup = size; |
|
151 |
|
152 unsigned short int* buff = 0; |
|
153 |
|
154 if (size & 0x01) |
|
155 { |
|
156 throw std::runtime_error("Decoding 8bit text into std::wstring"); |
|
157 } |
|
158 else |
|
159 { |
|
160 size = size >> 1; |
|
161 buff = new unsigned short int[(int)size]; |
|
162 TUnicodeExpander exp; |
|
163 TMemoryUnicodeSink sink((TUint16*)buff); |
|
164 exp.ExpandL(sink, *this ,size); |
|
165 unsigned short int* source = buff; |
|
166 wchar_t buffer[size]; |
|
167 // Using a temp variable in place of buffer as ConvertUTF16toUTF32 modifies the source pointer passed. |
|
168 wchar_t* temp = buffer; |
|
169 |
|
170 ConvertUTF16toUTF32(&source, source + sizebackup, &temp, temp + size, lenientConversion); |
|
171 |
|
172 // Appending NUL to the converted buffer. |
|
173 *temp = 0; |
|
174 val.assign(buffer, size); |
|
175 |
|
176 } |
|
177 |
|
178 ConvertToForwardSlash(val); |
|
179 |
|
180 delete buff; |
|
181 return *this; |
|
182 } |
|
183 |
|
184 #else |
139 |
185 |
140 Deserialiser& operator>>(std::wstring& val) |
186 Deserialiser& operator>>(std::wstring& val) |
141 { |
187 { |
142 |
188 |
143 Cardinality card; |
189 Cardinality card; |
159 } |
205 } |
160 val.assign(buff, size); |
206 val.assign(buff, size); |
161 delete buff; |
207 delete buff; |
162 return *this; |
208 return *this; |
163 } |
209 } |
|
210 #endif |
164 |
211 |
165 void read(TUint8* aDst, TUint32 aCount) |
212 void read(TUint8* aDst, TUint32 aCount) |
166 { |
213 { |
167 iStream.read((char*)aDst, aCount); |
214 iStream.read((char*)aDst, aCount); |
168 } |
215 } |