diff -r 000000000000 -r eb1f2e154e89 textinput/peninputgenericitut/src/peninputgenericitutconverter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/textinput/peninputgenericitut/src/peninputgenericitutconverter.cpp Tue Feb 02 01:02:04 2010 +0200 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "peninputgenericitutconverter.h" + +const TUint16 KSegment = 0x0020; + +TInt TItutDataConverter::AnyToInt(TAny* aOriginal) + { + return *(reinterpret_cast(aOriginal)); + } + +TRect TItutDataConverter::AnyToRect(TAny* aOriginal) + { + return *(reinterpret_cast(aOriginal)); + } + +CFont* TItutDataConverter::AnyToFont(TAny* aOriginal) + { + return reinterpret_cast(aOriginal); + } + +TPoint TItutDataConverter::AnyToPoint(TAny* aOriginal) + { + return *(reinterpret_cast(aOriginal)); + } + +TRgb TItutDataConverter::AnyToRgb(TAny* aOriginal) + { + return *(reinterpret_cast(aOriginal)); + } + +TSize TItutDataConverter::AnyToSize(TAny* aOriginal) + { + return *(reinterpret_cast(aOriginal)); + } + +RPointerArray& TItutDataConverter::AnyToRptrArray(TAny* aOriginal) + { + return *(reinterpret_cast*>(aOriginal)); + } + +RArray& TItutDataConverter::AnyToRectArray(TAny* aOriginal) + { + return *(reinterpret_cast*>(aOriginal)); + } + +TAknTextLineLayout TItutDataConverter::AnyToTextLine(TAny* aOriginal) + { + return *(reinterpret_cast(aOriginal)); + } + +void TItutDataConverter::ConvertChnPhraseCandidateL(const TDesC& aSource, + RPointerArray& aList) + { + TInt start = 0; + TInt length = 0; + + for (TInt ii = 0; ii < aSource.Length(); ii++) + { + if (aSource[ii] == KSegment) + { + TPtrC segment(aSource.Ptr() + start, length); + aList.AppendL(segment.AllocL()); + start += (length + 1); + length = 0; + } + else + { + length++; + } + } + + if (length) + { + TPtrC segm(aSource.Ptr() + start, length); + aList.AppendL(segm.AllocL()); + } + } + +void TItutDataConverter::ConvertNonPhraseCandidateL(const TDesC& aSource, + RPointerArray& aList) + { + TBuf<1> str; + for (TInt ii = 0; ii < aSource.Length(); ii++) + { + str.Zero(); + str.Append(aSource[ii]); + aList.AppendL(str.AllocL()); + } + } + +// End Of File