Mercurial > projects > dstep
annotate dstep/coreservices/carboncore/TextEncodingConverter.d @ 27:57371c29ef73 default tip
ObjcWrap is now automatically mixed in. Added support for building as a dylib with DMD.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 09 Apr 2010 23:00:22 +0200 |
parents | 07194b026fa4 |
children |
rev | line source |
---|---|
11
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
1 /** |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
3 * Authors: Jacob Carlborg |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
4 * Version: Initial created: Jul 21, 2009 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
6 */ |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
7 module dstep.coreservices.carboncore.TextEncodingConverter; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
8 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
9 //import dstep.AvailabilityMacros; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
10 import dstep.corefoundation.CFBase; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
11 import dstep.coreservices.carboncore.MacTypes; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
12 import dstep.coreservices.carboncore.TextCommon; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
13 import dstep.corefoundation.CFString; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
14 import dstep.objc.bridge.TypeEncoding; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
15 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
16 struct OpaqueTECObjectRef; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
17 struct OpaqueTECSnifferObjectRef; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
18 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
19 alias uint TECPluginSignature; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
20 alias uint TECPluginVersion; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
21 alias OpaqueTECObjectRef* TECObjectRef; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
22 alias OpaqueTECSnifferObjectRef* TECSnifferObjectRef; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
23 alias uint TECPluginSig; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
24 alias uint TECInternetNameUsageMask; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
25 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
26 // This is needed otherwise the enums will fail compiling with gdc |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
27 version (GNU) |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
28 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
29 private |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
30 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
31 const __kTECSignature = getOSType!("encv"); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
32 const __kTECUnicodePluginSignature = getOSType!("puni"); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
33 const __kTECJapanesePluginSignature = getOSType!("pjpn"); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
34 const __kTECChinesePluginSignature = getOSType!("pzho"); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
35 const __kTECKoreanPluginSignature = getOSType!("pkor"); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
36 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
37 } |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
38 } |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
39 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
40 enum |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
41 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
42 kTECSignature = getOSType!("encv"), |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
43 kTECUnicodePluginSignature = getOSType!("puni"), |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
44 kTECJapanesePluginSignature = getOSType!("pjpn"), |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
45 kTECChinesePluginSignature = getOSType!("pzho"), |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
46 kTECKoreanPluginSignature = getOSType!("pkor") |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
47 } |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
48 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
49 enum |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
50 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
51 kTECInternetNameDefaultUsageMask = 0, |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
52 kTECInternetNameStrictUsageMask = 1, |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
53 kTECInternetNameTolerantUsageMask = 2 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
54 } |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
55 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
56 enum |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
57 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
58 kTEC_MIBEnumDontCare = -1 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
59 } |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
60 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
61 struct TECConversionInfo |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
62 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
63 uint sourceEncoding; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
64 uint destinationEncoding; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
65 ushort reserved1; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
66 ushort reserved2; |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
67 } |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
68 |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
69 extern (C) |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
70 { |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
71 int TECCountAvailableTextEncodings (ItemCount* numberEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
72 int TECGetAvailableTextEncodings (TextEncoding* availableEncodings, uint maxAvailableEncodings, ItemCount* actualAvailableEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
73 int TECCountDirectTextEncodingConversions (ItemCount* numberOfEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
74 int TECGetDirectTextEncodingConversions (TECConversionInfo* availableConversions, uint maxAvailableConversions, ItemCount* actualAvailableConversions); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
75 int TECCountDestinationTextEncodings (uint inputEncoding, ItemCount* numberOfEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
76 int TECGetDestinationTextEncodings (uint inputEncoding, TextEncoding* destinationEncodings, uint maxDestinationEncodings, ItemCount* actualDestinationEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
77 int TECGetTextEncodingInternetName (uint textEncoding, ubyte[256] encodingName); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
78 int TECGetTextEncodingFromInternetName (TextEncoding* textEncoding, char* encodingName); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
79 int TECCreateConverter (TECObjectRef* newEncodingConverter, uint inputEncoding, uint outputEncoding); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
80 int TECCreateConverterFromPath (TECObjectRef* newEncodingConverter, TextEncoding* inPath, uint inEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
81 int TECDisposeConverter (TECObjectRef newEncodingConverter); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
82 int TECClearConverterContextInfo (TECObjectRef encodingConverter); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
83 int TECConvertText (TECObjectRef encodingConverter, char* inputBuffer, uint inputBufferLength, ByteCount* actualInputLength, char* outputBuffer, uint outputBufferLength, ByteCount* actualOutputLength); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
84 int TECFlushText (TECObjectRef encodingConverter, char* outputBuffer, uint outputBufferLength, ByteCount* actualOutputLength); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
85 int TECCountSubTextEncodings (uint inputEncoding, ItemCount* numberOfEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
86 int TECGetSubTextEncodings (uint inputEncoding, TextEncoding* subEncodings, uint maxSubEncodings, ItemCount* actualSubEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
87 int TECGetEncodingList (TECObjectRef encodingConverter, ItemCount* numEncodings, Handle* encodingList); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
88 int TECCreateOneToManyConverter (TECObjectRef* newEncodingConverter, uint inputEncoding, uint numOutputEncodings, TextEncoding* outputEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
89 int TECConvertTextToMultipleEncodings (TECObjectRef encodingConverter, char* inputBuffer, uint inputBufferLength, ByteCount* actualInputLength, char* outputBuffer, uint outputBufferLength, ByteCount* actualOutputLength, TextEncodingRun* outEncodingsBuffer, uint maxOutEncodingRuns, ItemCount* actualOutEncodingRuns); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
90 int TECFlushMultipleEncodings (TECObjectRef encodingConverter, char* outputBuffer, uint outputBufferLength, ByteCount* actualOutputLength, TextEncodingRun* outEncodingsBuffer, uint maxOutEncodingRuns, ItemCount* actualOutEncodingRuns); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
91 int TECCountWebTextEncodings (short locale, ItemCount* numberEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
92 int TECGetWebTextEncodings (short locale, TextEncoding* availableEncodings, uint maxAvailableEncodings, ItemCount* actualAvailableEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
93 int TECCountMailTextEncodings (short locale, ItemCount* numberEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
94 int TECGetMailTextEncodings (short locale, TextEncoding* availableEncodings, uint maxAvailableEncodings, ItemCount* actualAvailableEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
95 int TECCountAvailableSniffers (ItemCount* numberOfEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
96 int TECGetAvailableSniffers (TextEncoding* availableSniffers, uint maxAvailableSniffers, ItemCount* actualAvailableSniffers); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
97 int TECCreateSniffer (TECSnifferObjectRef* encodingSniffer, TextEncoding* testEncodings, uint numTextEncodings); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
98 int TECSniffTextEncoding (TECSnifferObjectRef encodingSniffer, char* inputBuffer, uint inputBufferLength, TextEncoding* testEncodings, uint numTextEncodings, ItemCount* numErrsArray, uint maxErrs, ItemCount* numFeaturesArray, uint maxFeatures); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
99 int TECDisposeSniffer (TECSnifferObjectRef encodingSniffer); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
100 int TECClearSnifferContextInfo (TECSnifferObjectRef encodingSniffer); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
101 int TECSetBasicOptions (TECObjectRef encodingConverter, uint controlFlags); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
102 int TECCopyTextEncodingInternetNameAndMIB (uint textEncoding, uint usage, CFStringRef* encodingNamePtr, SInt32* mibEnumPtr); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
103 int TECGetTextEncodingFromInternetNameOrMIB (TextEncoding* textEncodingPtr, uint usage, CFStringRef encodingName, int mibEnum); |
07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
Jacob Carlborg <doob@me.com>
parents:
diff
changeset
|
104 } |