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