comparison dstep/corefoundation/CFString.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
comparison
equal deleted inserted replaced
10:27e00625790b 11:07194b026fa4
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Jul 12, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.corefoundation.CFString;
8
9 import dstep.corefoundation.CFArray;
10 import dstep.corefoundation.CFBase;
11 import dstep.corefoundation.CFCharacterSet;
12 import dstep.corefoundation.CFData;
13 import dstep.corefoundation.CFDictionary;
14 import dstep.corefoundation.CFLocale;
15 import dstep.objc.bridge.Bridge;
16 import dstep.objc.objc : id;
17 //import dstep.stdarg;
18
19 alias uint CFStringEncoding;
20 alias uint CFStringBuiltInEncodings;
21 alias uint CFStringCompareFlags;
22 alias int CFStringNormalizationForm;
23
24 extern (C)
25 {
26 extern
27 {
28 const CFStringRef kCFStringTransformStripCombiningMarks;
29 const CFStringRef kCFStringTransformToLatin;
30 const CFStringRef kCFStringTransformFullwidthHalfwidth;
31 const CFStringRef kCFStringTransformLatinKatakana;
32 const CFStringRef kCFStringTransformLatinHiragana;
33 const CFStringRef kCFStringTransformHiraganaKatakana;
34 const CFStringRef kCFStringTransformMandarinLatin;
35 const CFStringRef kCFStringTransformLatinHangul;
36 const CFStringRef kCFStringTransformLatinArabic;
37 const CFStringRef kCFStringTransformLatinHebrew;
38 const CFStringRef kCFStringTransformLatinThai;
39 const CFStringRef kCFStringTransformLatinCyrillic;
40 const CFStringRef kCFStringTransformLatinGreek;
41 const CFStringRef kCFStringTransformToXMLHex;
42 const CFStringRef kCFStringTransformToUnicodeName;
43 const CFStringRef kCFStringTransformStripDiacritics;
44 }
45 }
46
47 enum
48 {
49 kCFStringEncodingMacRoman = 0,
50 kCFStringEncodingWindowsLatin1 = 0x0500,
51 kCFStringEncodingISOLatin1 = 0x0201,
52 kCFStringEncodingNextStepLatin = 0x0B01,
53 kCFStringEncodingASCII = 0x0600,
54 kCFStringEncodingUnicode = 0x0100,
55 kCFStringEncodingUTF8 = 0x08000100,
56 kCFStringEncodingNonLossyASCII = 0x0BFF,
57 kCFStringEncodingUTF16 = 0x0100,
58 kCFStringEncodingUTF16BE = 0x10000100,
59 kCFStringEncodingUTF16LE = 0x14000100,
60 kCFStringEncodingUTF32 = 0x0c000100,
61 kCFStringEncodingUTF32BE = 0x18000100,
62 kCFStringEncodingUTF32LE = 0x1c000100
63 }
64
65 enum
66 {
67 kCFCompareCaseInsensitive = 1,
68 kCFCompareBackwards = 4,
69 kCFCompareAnchored = 8,
70 kCFCompareNonliteral = 16,
71 kCFCompareLocalized = 32,
72 kCFCompareNumerically = 64,
73 kCFCompareDiacriticInsensitive = 128,
74 kCFCompareWidthInsensitive = 256,
75 kCFCompareForcedOrdering = 512
76 }
77
78 enum
79 {
80 kCFStringNormalizationFormD = 0,
81 kCFStringNormalizationFormKD,
82 kCFStringNormalizationFormC,
83 kCFStringNormalizationFormKC
84 }
85
86 struct CFStringInlineBuffer
87 {
88 wchar* buffer;
89 CFStringRef theString;
90 wchar* directBuffer;
91 CFRange rangeToBuffer;
92 int bufferedRangeStart;
93 int bufferedRangeEnd;
94 }
95
96 extern (C)
97 {
98 uint CFStringGetTypeID ();
99 CFStringRef CFStringCreateWithPascalString (CFAllocatorRef alloc, char* pStr, uint encoding);
100 CFStringRef CFStringCreateWithCString (CFAllocatorRef alloc, char* cStr, uint encoding);
101 CFStringRef CFStringCreateWithBytes (CFAllocatorRef alloc, char* bytes, int numBytes, uint encoding, ubyte isExternalRepresentation);
102 CFStringRef CFStringCreateWithCharacters (CFAllocatorRef alloc, wchar* chars, int numChars);
103 CFStringRef CFStringCreateWithPascalStringNoCopy (CFAllocatorRef alloc, char* pStr, uint encoding, CFAllocatorRef contentsDeallocator);
104 CFStringRef CFStringCreateWithCStringNoCopy (CFAllocatorRef alloc, char* cStr, uint encoding, CFAllocatorRef contentsDeallocator);
105 CFStringRef CFStringCreateWithBytesNoCopy (CFAllocatorRef alloc, char* bytes, int numBytes, uint encoding, ubyte isExternalRepresentation, CFAllocatorRef contentsDeallocator);
106 CFStringRef CFStringCreateWithCharactersNoCopy (CFAllocatorRef alloc, wchar* chars, int numChars, CFAllocatorRef contentsDeallocator);
107 CFStringRef CFStringCreateWithSubstring (CFAllocatorRef alloc, CFStringRef str, CFRange range);
108 CFStringRef CFStringCreateCopy (CFAllocatorRef alloc, CFStringRef theString);
109 CFStringRef CFStringCreateWithFormat (CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, ...);
110 CFStringRef CFStringCreateWithFormatAndArguments (CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, char* arguments);
111 CFMutableStringRef CFStringCreateMutable (CFAllocatorRef alloc, int maxLength);
112 CFMutableStringRef CFStringCreateMutableCopy (CFAllocatorRef alloc, int maxLength, CFStringRef theString);
113 CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy (CFAllocatorRef alloc, wchar* chars, int numChars, int capacity, CFAllocatorRef externalCharactersAllocator);
114 int CFStringGetLength (CFStringRef theString);
115 wchar CFStringGetCharacterAtIndex (CFStringRef theString, int idx);
116 void CFStringGetCharacters (CFStringRef theString, CFRange range, wchar* buffer);
117 ubyte CFStringGetPascalString (CFStringRef theString, char* buffer, int bufferSize, uint encoding);
118 ubyte CFStringGetCString (CFStringRef theString, char* buffer, int bufferSize, uint encoding);
119 char* CFStringGetPascalStringPtr (CFStringRef theString, uint encoding);
120 char* CFStringGetCStringPtr (CFStringRef theString, uint encoding);
121 wchar* CFStringGetCharactersPtr (CFStringRef theString);
122 int CFStringGetBytes (CFStringRef theString, CFRange range, uint encoding, ubyte lossByte, ubyte isExternalRepresentation, char* buffer, int maxBufLen, int* usedBufLen);
123 CFStringRef CFStringCreateFromExternalRepresentation (CFAllocatorRef alloc, CFDataRef data, uint encoding);
124 CFDataRef CFStringCreateExternalRepresentation (CFAllocatorRef alloc, CFStringRef theString, uint encoding, ubyte lossByte);
125 uint CFStringGetSmallestEncoding (CFStringRef theString);
126 uint CFStringGetFastestEncoding (CFStringRef theString);
127 uint CFStringGetSystemEncoding ();
128 int CFStringGetMaximumSizeForEncoding (int length, uint encoding);
129 ubyte CFStringGetFileSystemRepresentation (CFStringRef string, char* buffer, int maxBufLen);
130 int CFStringGetMaximumSizeOfFileSystemRepresentation (CFStringRef string);
131 CFStringRef CFStringCreateWithFileSystemRepresentation (CFAllocatorRef alloc, char* buffer);
132 int CFStringCompareWithOptionsAndLocale (CFStringRef theString1, CFStringRef theString2, CFRange rangeToCompare, uint compareOptions, CFLocaleRef locale);
133 int CFStringCompareWithOptions (CFStringRef theString1, CFStringRef theString2, CFRange rangeToCompare, uint compareOptions);
134 int CFStringCompare (CFStringRef theString1, CFStringRef theString2, uint compareOptions);
135 ubyte CFStringFindWithOptionsAndLocale (CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, uint searchOptions, CFLocaleRef locale, CFRange* result);
136 ubyte CFStringFindWithOptions (CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, uint searchOptions, CFRange* result);
137 CFArrayRef CFStringCreateArrayWithFindResults (CFAllocatorRef alloc, CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, uint compareOptions);
138 CFRange CFStringFind (CFStringRef theString, CFStringRef stringToFind, uint compareOptions);
139 ubyte CFStringHasPrefix (CFStringRef theString, CFStringRef prefix);
140 ubyte CFStringHasSuffix (CFStringRef theString, CFStringRef suffix);
141 CFRange CFStringGetRangeOfComposedCharactersAtIndex (CFStringRef theString, int theIndex);
142 ubyte CFStringFindCharacterFromSet (CFStringRef theString, CFCharacterSetRef theSet, CFRange rangeToSearch, uint searchOptions, CFRange* result);
143 void CFStringGetLineBounds (CFStringRef theString, CFRange range, int* lineBeginIndex, int* lineEndIndex, int* contentsEndIndex);
144 void CFStringGetParagraphBounds (CFStringRef string, CFRange range, int* parBeginIndex, int* parEndIndex, int* contentsEndIndex);
145 CFStringRef CFStringCreateByCombiningStrings (CFAllocatorRef alloc, CFArrayRef theArray, CFStringRef separatorString);
146 CFArrayRef CFStringCreateArrayBySeparatingStrings (CFAllocatorRef alloc, CFStringRef theString, CFStringRef separatorString);
147 int CFStringGetIntValue (CFStringRef str);
148 double CFStringGetDoubleValue (CFStringRef str);
149 void CFStringAppend (CFMutableStringRef theString, CFStringRef appendedString);
150 void CFStringAppendCharacters (CFMutableStringRef theString, wchar* chars, int numChars);
151 void CFStringAppendPascalString (CFMutableStringRef theString, char* pStr, uint encoding);
152 void CFStringAppendCString (CFMutableStringRef theString, char* cStr, uint encoding);
153 void CFStringAppendFormat (CFMutableStringRef theString, CFDictionaryRef formatOptions, CFStringRef format, ...);
154 void CFStringAppendFormatAndArguments (CFMutableStringRef theString, CFDictionaryRef formatOptions, CFStringRef format, char* arguments);
155 void CFStringInsert (CFMutableStringRef str, int idx, CFStringRef insertedStr);
156 void CFStringDelete (CFMutableStringRef theString, CFRange range);
157 void CFStringReplace (CFMutableStringRef theString, CFRange range, CFStringRef replacement);
158 void CFStringReplaceAll (CFMutableStringRef theString, CFStringRef replacement);
159 int CFStringFindAndReplace (CFMutableStringRef theString, CFStringRef stringToFind, CFStringRef replacementString, CFRange rangeToSearch, uint compareOptions);
160 void CFStringSetExternalCharactersNoCopy (CFMutableStringRef theString, wchar* chars, int length, int capacity);
161 void CFStringPad (CFMutableStringRef theString, CFStringRef padString, int length, int indexIntoPad);
162 void CFStringTrim (CFMutableStringRef theString, CFStringRef trimString);
163 void CFStringTrimWhitespace (CFMutableStringRef theString);
164 void CFStringLowercase (CFMutableStringRef theString, CFLocaleRef locale);
165 void CFStringUppercase (CFMutableStringRef theString, CFLocaleRef locale);
166 void CFStringCapitalize (CFMutableStringRef theString, CFLocaleRef locale);
167 void CFStringNormalize (CFMutableStringRef theString, int theForm);
168 void CFStringFold (CFMutableStringRef theString, uint theFlags, CFLocaleRef theLocale);
169 ubyte CFStringTransform (CFMutableStringRef string, CFRange* range, CFStringRef transform, ubyte reverse);
170 ubyte CFStringIsEncodingAvailable (uint encoding);
171 uint* CFStringGetListOfAvailableEncodings ();
172 CFStringRef CFStringGetNameOfEncoding (uint encoding);
173 uint CFStringConvertEncodingToNSStringEncoding (uint encoding);
174 uint CFStringConvertNSStringEncodingToEncoding (uint encoding);
175 uint CFStringConvertEncodingToWindowsCodepage (uint encoding);
176 uint CFStringConvertWindowsCodepageToEncoding (uint codepage);
177 uint CFStringConvertIANACharSetNameToEncoding (CFStringRef theString);
178 CFStringRef CFStringConvertEncodingToIANACharSetName (uint encoding);
179 uint CFStringGetMostCompatibleMacStringEncoding (uint encoding);
180 void CFShow (void* obj);
181 void CFShowStr (CFStringRef str);
182 CFStringRef __CFStringMakeConstantString (char* cStr);
183 }