1 /* |
|
2 * Copyright (c) 2000-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* ================================================================ */ |
|
18 /* |
|
19 File: ConvertUTF7.h |
|
20 Author: David B. Goldsmith |
|
21 Copyright (C) 1994 Taligent, Inc. All rights reserved. |
|
22 |
|
23 This code is copyrighted. Under the copyright laws, this code may not |
|
24 be copied, in whole or part, without prior written consent of Taligent. |
|
25 |
|
26 Taligent grants the right to use this code as long as this ENTIRE |
|
27 copyright notice is reproduced in the code. The code is provided |
|
28 AS-IS, AND TALIGENT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR |
|
29 IMPLIED, INCLUDING, BUT NOT LIMITED TO IMPLIED WARRANTIES OF |
|
30 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT |
|
31 WILL TALIGENT BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, |
|
32 WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS |
|
33 INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY |
|
34 LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THIS CODE, EVEN |
|
35 IF TALIGENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
|
36 BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF |
|
37 LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE |
|
38 LIMITATION MAY NOT APPLY TO YOU. |
|
39 |
|
40 RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the |
|
41 government is subject to restrictions as set forth in subparagraph |
|
42 (c)(l)(ii) of the Rights in Technical Data and Computer Software |
|
43 clause at DFARS 252.227-7013 and FAR 52.227-19. |
|
44 |
|
45 This code may be protected by one or more U.S. and International |
|
46 Patents. |
|
47 |
|
48 TRADEMARKS: Taligent and the Taligent Design Mark are registered |
|
49 trademarks of Taligent, Inc. |
|
50 */ |
|
51 /* ================================================================ */ |
|
52 |
|
53 /* ================================================================ */ |
|
54 /* The following definitions are compiler-specific. |
|
55 I would use wchar_t for UCS2/UTF16, except that the C standard |
|
56 does not guarantee that it has at least 16 bits, so wchar_t is |
|
57 no more portable than unsigned short! |
|
58 */ |
|
59 |
|
60 typedef unsigned short UCS2; |
|
61 |
|
62 /* ================================================================ */ |
|
63 /* Each of these routines converts the text between *sourceStart and |
|
64 sourceEnd, putting the result into the buffer between *targetStart and |
|
65 targetEnd. Note: the end pointers are *after* the last item: e.g. |
|
66 *(sourceEnd - 1) is the last item. |
|
67 |
|
68 The return result indicates whether the conversion was successful, |
|
69 and if not, whether the problem was in the source or target buffers. |
|
70 |
|
71 After the conversion, *sourceStart and *targetStart are both |
|
72 updated to point to the end of last text successfully converted in |
|
73 the respective buffers. |
|
74 |
|
75 In ConvertUCS2toUTF7, optional indicates whether UTF-7 optional |
|
76 characters should be directly encoded, and verbose controls whether the |
|
77 shift-out character, "-", is always emitted at the end of a shifted |
|
78 sequence. |
|
79 */ |
|
80 |
|
81 #if !defined(__E32STD_H__) // added by DPB |
|
82 #include <e32std.h> // added by DPB |
|
83 #endif // added by DPB |
|
84 |
|
85 typedef enum { |
|
86 ok, /* conversion successful */ |
|
87 sourceCorrupt, /* source contains invalid UTF-7 */ |
|
88 targetExhausted /* insuff. room in target for conversion */ |
|
89 } ConversionResult; |
|
90 |
|
91 |
|
92 IMPORT_C ConversionResult ConvertUCS2toUTF7 ( // added by DPB |
|
93 //extern ConversionResult ConvertUCS2toUTF7 ( // commented out by DPB |
|
94 UCS2** sourceStart, UCS2* sourceEnd, |
|
95 char** targetStart, char* targetEnd, |
|
96 int optional, int verbose); |
|
97 |
|
98 IMPORT_C ConversionResult ConvertUTF7toUCS2 ( // added by DPB |
|
99 //extern ConversionResult ConvertUTF7toUCS2 ( // commented out by DPB |
|
100 char** sourceStart, char* sourceEnd, |
|
101 UCS2** targetStart, UCS2* targetEnd); |
|
102 |
|
103 /* ================================================================ */ |
|