1.1 --- a/epoc32/include/vutil.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,189 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __VUTIL_H__
1.20 -#define __VUTIL_H__
1.21 -
1.22 -// System includes
1.23 -#ifndef __E32BASE_H__
1.24 -#include <e32base.h>
1.25 -#endif
1.26 -#ifndef __F32FILE_H__
1.27 -#include <f32file.h>
1.28 -#endif
1.29 -#ifndef __CHARCONV_H__
1.30 -#include <charconv.h>
1.31 -#endif
1.32 -
1.33 -
1.34 -class Versit
1.35 -/** Provides Versit-specific encoding and character set identifiers.
1.36 -@publishedAll
1.37 -@released
1.38 -*/
1.39 - {
1.40 -public:
1.41 - /** Versit-specific encoding identifiers.
1.42 - @publishedAll
1.43 - @released
1.44 - */
1.45 - enum TVersitEncoding
1.46 - {
1.47 - /** No encoding. */
1.48 - ENoEncoding,
1.49 - /** Quoted Printable encoding. */
1.50 - EQuotedPrintableEncoding,
1.51 - /** Base 64 encoding. */
1.52 - EBase64Encoding,
1.53 -
1.54 - // Used internally - not to be used by versit clients
1.55 - /** Eight bit encoding. */
1.56 - EEightBitEncoding
1.57 - };
1.58 -
1.59 - /** Versit-specific character set identifiers. These are used in the Versit API
1.60 - to represent foreign (non-Unicode) character sets for vCard and vCalendar
1.61 - properties.
1.62 - @publishedAll
1.63 - @released */
1.64 - enum TVersitCharSet
1.65 - {
1.66 - /** Unknown character set. */
1.67 - EUnknownCharSet,
1.68 - /** ASCII (7-bit).*/
1.69 - EUSAsciiCharSet,
1.70 - /** UTF-8 Unicode transformation format. */
1.71 - EUTF8CharSet,
1.72 - /** UTF-7 Unicode transformation format. */
1.73 - EUTF7CharSet,
1.74 - /** ISO 8859-1 (8-bit). */
1.75 - EISO88591CharSet,
1.76 - /** ISO 8859-2 (8-bit). */
1.77 - EISO88592CharSet,
1.78 - /** ISO 8859-4 (8-bit). */
1.79 - EISO88594CharSet,
1.80 - /** ISO 8859-5 (8-bit). */
1.81 - EISO88595CharSet,
1.82 - /** ISO 8859-7 (8-bit). */
1.83 - EISO88597CharSet,
1.84 - /** ISO 8859-9 (8-bit). */
1.85 - EISO88599CharSet,
1.86 - /** ISO 8859-3 (8-bit). */
1.87 - EISO88593CharSet,
1.88 - /** ISO 8859-10 (8-bit). */
1.89 - EISO885910CharSet,
1.90 - /** GB 2312. */
1.91 - EGB231280CharSet,
1.92 - /** GBK. */
1.93 - EGBKCharSet,
1.94 - /** Big 5. */
1.95 - EBIG5CharSet,
1.96 - /** ISO-2022-JP. */
1.97 - EISO2022JPCharSet,
1.98 - /** EUC-JP. */
1.99 - EEUCJPCharSet,
1.100 - /** Shift JIS. */
1.101 - EShiftJISCharSet,
1.102 - /** JIS. */
1.103 - EJISCharSet,
1.104 - /** Must be first character set. */
1.105 - EFirstCharSet=EUSAsciiCharSet,
1.106 - /** Must be last character set. */
1.107 - ELastCharSet=EJISCharSet
1.108 - };
1.109 -
1.110 - class TEncodingAndCharset
1.111 - /** Specifies an encoding, a character set and a character set converter.
1.112 - @publishedAll
1.113 - @released */
1.114 - {
1.115 - public:
1.116 - inline TEncodingAndCharset(TVersitEncoding aEncoding,TUint aCharSetId) :iEncoding(aEncoding), iCharSetId(aCharSetId)
1.117 - /** The C++ constructor initialises the encoding and character set.
1.118 -
1.119 - @param aEncoding An encoding.
1.120 - @param aCharSetId A character set. */
1.121 - {}
1.122 - public:
1.123 - /** An encoding. */
1.124 - TVersitEncoding iEncoding;
1.125 - /** A character set. */
1.126 - TUint iCharSetId;
1.127 - /** A character set converter. */
1.128 - CCnvCharacterSetConverter* iConverter;
1.129 - };
1.130 - };
1.131 -
1.132 -class CVersitUnicodeUtils : public CBase
1.133 -/** Versit Unicode utilities class.
1.134 -
1.135 -This enables conversion between Unicode and ISO character sets.
1.136 -@publishedAll
1.137 -@released
1.138 -*/
1.139 - {
1.140 -public:
1.141 - IMPORT_C ~CVersitUnicodeUtils();
1.142 - IMPORT_C HBufC8* NarrowL(const TDesC& aDesC);
1.143 - IMPORT_C HBufC8* NarrowLC(const TDesC& aDesC);
1.144 - IMPORT_C HBufC* WidenL(const TDesC8& aDesC8);
1.145 - IMPORT_C HBufC* WidenLC(const TDesC8& aDesC8);
1.146 - IMPORT_C void CreateConverterL();
1.147 - CCnvCharacterSetConverter::TAvailability SetCurrentCharSetL(TUint aCharacterSet);
1.148 -
1.149 -public:
1.150 - inline CCnvCharacterSetConverter& CharacterSetConverter() const;
1.151 - inline TUint ConvertStandardNameL(const TDesC8& aStandardNameOfCharacterSet);
1.152 - inline HBufC8* StandardNameL(TUint aCharSetId);
1.153 - TUint AutoDetectCharSetL(const TDesC8& aSample,const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* aAutoDetectCharSets);
1.154 -
1.155 -private:
1.156 - RFs iFsSession;
1.157 - CCnvCharacterSetConverter* iUnicodeConverter;
1.158 - TBool iFsConnected;
1.159 - TUint iCurrentConverterCharSet;
1.160 - CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iCharSetsAvailable;
1.161 - };
1.162 -
1.163 -
1.164 -inline CCnvCharacterSetConverter& CVersitUnicodeUtils::CharacterSetConverter() const
1.165 -/** Returns the character set converter created in CreateConverterL().
1.166 -
1.167 -@return A character set converter. */
1.168 - {
1.169 - return *iUnicodeConverter;
1.170 - }
1.171 -inline TUint CVersitUnicodeUtils::ConvertStandardNameL(const TDesC8& aStandardNameOfCharacterSet)
1.172 -/** Returns the Symbian OS UID for a character set from its Internet-standard
1.173 -name.
1.174 -
1.175 -@param aStandardNameOfCharacterSet Internet-standard name of a character set
1.176 -encoded in 8-bit ASCII.
1.177 -@return The Symbian OS UID of the specified character set. If the name is not
1.178 -known, zero is returned. */
1.179 - {
1.180 - return iUnicodeConverter->ConvertStandardNameOfCharacterSetToIdentifierL(aStandardNameOfCharacterSet,iFsSession);
1.181 - }
1.182 -inline HBufC8* CVersitUnicodeUtils::StandardNameL(TUint aCharSetId)
1.183 -/** Returns the Internet-standard name of a character set, from its Symbian OS UID.
1.184 -
1.185 -@param aCharSetId The Symbian OS UID of a character set.
1.186 -@return The Internet-standard name or MIME name of the specified character
1.187 -set, or NULL if the UID is not known. The name is encoded in 8-bit ASCII. */
1.188 - {
1.189 - return iUnicodeConverter->ConvertCharacterSetIdentifierToStandardNameL(aCharSetId,iFsSession);
1.190 - }
1.191 -
1.192 -#endif