1.1 --- a/epoc32/include/imcvcodc.inl Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/imcvcodc.inl Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,161 @@
1.4 -imcvcodc.inl
1.5 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +//----------------------------------------------------------------------------------------
1.22 +LOCAL_C inline TInt BlankLine(TDes8& rOutputLine, TInt& rPaddingCount)
1.23 +//----------------------------------------------------------------------------------------
1.24 + {
1.25 + rOutputLine = KNullDesC8;
1.26 + rPaddingCount = KNullDesC8().Length();
1.27 + return 1;
1.28 + }
1.29 +
1.30 +
1.31 +// function for adding 8 bit descriptor onto a 16bit descritpr.
1.32 +//----------------------------------------------------------------------------------------
1.33 +LOCAL_C inline void Append(TDes& aBuffer, const TDesC8& aAddition)
1.34 +//----------------------------------------------------------------------------------------
1.35 + {
1.36 + TInt addLen = aAddition.Length();
1.37 + TInt bufLen = aBuffer.Length();
1.38 +
1.39 + aBuffer.SetLength(bufLen+addLen);
1.40 + for(TInt i = 0; i < addLen; i++)
1.41 + aBuffer[bufLen+i] = aAddition[i];
1.42 + }
1.43 +
1.44 +//----------------------------------------------------------------------------------------
1.45 +LOCAL_C inline void Append(TDes& aBuffer, const TDesC16& aAddition)
1.46 +//----------------------------------------------------------------------------------------
1.47 + {
1.48 + TInt addLen = aAddition.Length();
1.49 + TInt bufLen = aBuffer.Length();
1.50 +
1.51 + aBuffer.SetLength(bufLen+addLen);
1.52 + for(TInt i = 0; i < addLen; i++)
1.53 + aBuffer[bufLen+i] = aAddition[i];
1.54 + }
1.55 +
1.56 +
1.57 +//----------------------------------------------------------------------------------------
1.58 +inline TBool TImCodecQP::IsPlain( TChar aChar )
1.59 +//----------------------------------------------------------------------------------------
1.60 + {
1.61 + TLex8 lex(iEncodeCharList);
1.62 + while(!lex.Eos())
1.63 + if ( aChar==lex.Get() )
1.64 + return EFalse;
1.65 +
1.66 + if ( ((aChar >= 33) && (aChar <= 60)) || ((aChar >= 62) && (aChar <= 126)) )
1.67 + return ETrue;
1.68 +
1.69 + lex = iPlainCharList;
1.70 + while(!lex.Eos())
1.71 + if ( aChar==lex.Get() )
1.72 + return ETrue;
1.73 +
1.74 + return EFalse;
1.75 + }
1.76 +
1.77 +//----------------------------------------------------------------------------------------
1.78 +void TImCodecQP::AddSoftLineBreak( TDes8& aPtr, TInt& aPadding, TInt& aWritten)
1.79 +//----------------------------------------------------------------------------------------
1.80 + {
1.81 + __ASSERT_ALWAYS( aPtr.Length()+4< aPtr.MaxLength(), gPanic(KPanicDescriptorToSmall) );
1.82 + aPtr.Append(KImcvSP);
1.83 + aPtr.Append(iQPCharacter);
1.84 + aPtr.Append(KImcvCRLF);
1.85 + aWritten+=4;
1.86 + aPadding+=3;
1.87 + }
1.88 +
1.89 +//----------------------------------------------------------------------------------------
1.90 +void TImCodecQP::AddSoftLineBreak(const TUint8* apEnd, TUint8* aPtr, TInt& aPadding, TInt& aWritten)
1.91 +//----------------------------------------------------------------------------------------
1.92 + {
1.93 + __ASSERT_ALWAYS( aPtr+3<apEnd, gPanic(KPanicDescriptorToSmall) );
1.94 + *aPtr = KImcvSP;
1.95 + *aPtr = iQPCharacter;
1.96 + *aPtr = KImcvCR;
1.97 + *aPtr = KImcvLF;
1.98 + *aPtr+=4;
1.99 + aWritten+=4;
1.100 + aPadding+=3;
1.101 + }
1.102 +
1.103 +
1.104 +//----------------------------------------------------------------------------------------
1.105 +inline TBool TImCodec::IsDigit( TChar aChar )
1.106 +//----------------------------------------------------------------------------------------
1.107 + {
1.108 + return ( (aChar >= '0') && (aChar <= '9') );
1.109 + }
1.110 +
1.111 +//----------------------------------------------------------------------------------------
1.112 +inline TUint8 TImCodecQP::ReplacementChar( TChar aControlChar )
1.113 +//----------------------------------------------------------------------------------------
1.114 + {
1.115 + if (aControlChar==CEditableText::ETabCharacter)
1.116 + return KImcvTab;
1.117 +
1.118 + if (aControlChar==CEditableText::ENonBreakingHyphen)
1.119 + return KImcvHyphen;
1.120 +
1.121 + if (aControlChar==CEditableText::ENonBreakingSpace)
1.122 + return KImcvSP;
1.123 +
1.124 + return 0;
1.125 + }
1.126 +
1.127 +//----------------------------------------------------------------------------------------
1.128 +inline void TImCodecQP::AddPlainChar( const TDesC8& aCharList )
1.129 +//----------------------------------------------------------------------------------------
1.130 + {
1.131 + iPlainCharList.Set(aCharList);
1.132 + }
1.133 +
1.134 +
1.135 +//----------------------------------------------------------------------------------------
1.136 +inline void TImCodecQP::AddEncodeChar( const TDesC8& aCharList )
1.137 +//----------------------------------------------------------------------------------------
1.138 + {
1.139 + iEncodeCharList.Set(aCharList);
1.140 + }
1.141 +
1.142 +//----------------------------------------------------------------------------------------
1.143 +inline void TImCodecQP::SetQPChar( TUint8 aChar )
1.144 +//----------------------------------------------------------------------------------------
1.145 + {
1.146 + iQPCharacter=aChar;
1.147 + }
1.148 +
1.149 +// this function rather meanly allows a line break on a non-breaking tab and non-breaking
1.150 +// space, as defined in CEditableText
1.151 +
1.152 +//----------------------------------------------------------------------------------------
1.153 +inline TBool TImCodecQP::IsBreakable( TChar aChar)
1.154 +//----------------------------------------------------------------------------------------
1.155 + {
1.156 + return (aChar==' '||aChar=='\t');
1.157 + }
1.158 +
1.159 +
1.160 +//----------------------------------------------------------------------------------------
1.161 +inline CImConvertCharconv& CImConvertHeader::CharConv()
1.162 +//----------------------------------------------------------------------------------------
1.163 + {
1.164 + return iCharConv;
1.165 + }