--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/securityanddataprivacytools/securitytools/certapp/store--/utf.h Wed Jul 08 11:25:26 2009 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 1997-2009 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"
+* 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:
+*
+*/
+
+
+
+
+/**
+ @file
+ @internalComponent
+*/
+
+#if !defined(__UTF_H__)
+#define __UTF_H__
+
+#if !defined(__E32STD_H__)
+#include <e32std.h>
+#endif
+
+
+class CnvUtfConverter
+/**
+Converts text between Unicode (UCS-2) and the two Unicode transformation
+formats UTF-7 and UTF-8. There are no functions to convert directly between
+UTF-7 and UTF-8.
+
+Objects of this class do not need to be created because all the member functions
+are static. The four functions are passed text in the second argument and
+output the resulting text in the first argument. Sixteen-bit descriptors are
+used to hold text encoded in UCS-2 (i.e. normal 16 bit Unicode), and eight-bit
+descriptors are used to hold text encoded in either of the transformation
+formats.
+
+The conversion functions return the number of characters which were not converted
+because the output descriptor was not long enough to hold all of the converted
+text. This allows users of this class to perform partial conversions on an
+input descriptor, handling the case when the input descriptor is truncated
+mid way through a multi-byte character. The caller does not have to guess
+how big to make the output descriptor for a given input descriptor- they
+can simply do the conversion in a loop using a small output descriptor. The
+ability to handle truncated descriptors is particularly useful if the caller
+is receiving information in chunks from an external source.
+*/
+ {
+public:
+ /** Conversion error flags. At this stage there is only one error flag
+ - others may be added in the future. */
+ enum TError
+ {
+ /** The input descriptor contains a single corrupt character. This
+ might occur when the input descriptor only contains some of the bytes
+ of a single multi-byte character. */
+ EErrorIllFormedInput=KErrCorrupt
+ };
+
+ /** Initial value for the state argument in a set of related calls to
+ ConvertToUnicode(). */
+ enum {KStateDefault=0};
+public:
+ // the conversion functions return either one of the TError values above, or the number of unconverted elements left at the end of the input descriptor
+ IMPORT_C static TInt ConvertFromUnicodeToUtf8(TDes8& aUtf8, const TDesC16& aUnicode);
+ static TInt ConvertFromUnicodeToUtf8(TDes8& aUtf8, const TDesC16& aUnicode, TBool aGenerateJavaConformantUtf8);
+ IMPORT_C static TInt ConvertToUnicodeFromUtf8(TDes16& aUnicode, const TDesC8& aUtf8);
+ static TInt ConvertToUnicodeFromUtf8(TDes16& aUnicode, const TDesC8& aUtf8, TBool aGenerateJavaConformantUtf8);
+ static TInt ConvertToUnicodeFromUtf8(TDes16& aUnicode, const TDesC8& aUtf8, TBool aGenerateJavaConformantUtf8,
+ TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
+
+ };
+
+#endif