secureswitools/swisistools/source/interpretsislib/deserialiser.h
branchRCL_3
changeset 24 5cc91383ab1e
parent 0 ba25891c3a9e
child 25 7333d7932ef7
--- a/secureswitools/swisistools/source/interpretsislib/deserialiser.h	Thu Jul 15 18:47:04 2010 +0300
+++ b/secureswitools/swisistools/source/interpretsislib/deserialiser.h	Thu Aug 19 10:02:49 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
@@ -26,6 +26,8 @@
 #include "serialisable.h"
 #include "cardinality.h"
 #include "ucmp.h"
+#include "utf8.h"
+#include "is_utils.h"
 
 #pragma warning (disable: 4800)
 
@@ -137,6 +139,50 @@
 	return *this;
 	}
 
+#ifdef __TOOLS2_LINUX__
+
+	Deserialiser& operator>>(std::wstring& val)
+	{
+		Cardinality card;
+		*this >> card;
+		TUint32 size = card;
+
+		TUint32 sizebackup = size;
+
+		unsigned short int* buff = 0;
+	
+		if (size & 0x01)
+		{
+			throw std::runtime_error("Decoding 8bit text into std::wstring");
+		}
+		else
+		{
+			size = size >> 1;
+			buff = new unsigned short int[(int)size];
+			TUnicodeExpander exp;
+			TMemoryUnicodeSink sink((TUint16*)buff);
+			exp.ExpandL(sink, *this ,size);
+			unsigned short int* source = buff;
+			wchar_t buffer[size];
+			// Using a temp variable in place of buffer as ConvertUTF16toUTF32 modifies the source pointer passed.
+			wchar_t* temp = buffer;
+	
+			ConvertUTF16toUTF32(&source, source + sizebackup, &temp,  temp + size, lenientConversion);
+	
+			// Appending NUL to the converted buffer.
+			*temp = 0;
+			val.assign(buffer, size);
+
+		}
+
+		ConvertToForwardSlash(val);
+
+		delete buff;
+		return *this;
+	}
+
+#else
+
 	Deserialiser& operator>>(std::wstring& val)
 	{
 
@@ -161,6 +207,7 @@
 	delete buff;
 	return *this;
 	}
+#endif
 
 	void read(TUint8* aDst, TUint32 aCount)
 	{