Mercurial > projects > dstep
view 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 |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Jul 12, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.corefoundation.CFString; import dstep.corefoundation.CFArray; import dstep.corefoundation.CFBase; import dstep.corefoundation.CFCharacterSet; import dstep.corefoundation.CFData; import dstep.corefoundation.CFDictionary; import dstep.corefoundation.CFLocale; import dstep.objc.bridge.Bridge; import dstep.objc.objc : id; //import dstep.stdarg; alias uint CFStringEncoding; alias uint CFStringBuiltInEncodings; alias uint CFStringCompareFlags; alias int CFStringNormalizationForm; extern (C) { extern { const CFStringRef kCFStringTransformStripCombiningMarks; const CFStringRef kCFStringTransformToLatin; const CFStringRef kCFStringTransformFullwidthHalfwidth; const CFStringRef kCFStringTransformLatinKatakana; const CFStringRef kCFStringTransformLatinHiragana; const CFStringRef kCFStringTransformHiraganaKatakana; const CFStringRef kCFStringTransformMandarinLatin; const CFStringRef kCFStringTransformLatinHangul; const CFStringRef kCFStringTransformLatinArabic; const CFStringRef kCFStringTransformLatinHebrew; const CFStringRef kCFStringTransformLatinThai; const CFStringRef kCFStringTransformLatinCyrillic; const CFStringRef kCFStringTransformLatinGreek; const CFStringRef kCFStringTransformToXMLHex; const CFStringRef kCFStringTransformToUnicodeName; const CFStringRef kCFStringTransformStripDiacritics; } } enum { kCFStringEncodingMacRoman = 0, kCFStringEncodingWindowsLatin1 = 0x0500, kCFStringEncodingISOLatin1 = 0x0201, kCFStringEncodingNextStepLatin = 0x0B01, kCFStringEncodingASCII = 0x0600, kCFStringEncodingUnicode = 0x0100, kCFStringEncodingUTF8 = 0x08000100, kCFStringEncodingNonLossyASCII = 0x0BFF, kCFStringEncodingUTF16 = 0x0100, kCFStringEncodingUTF16BE = 0x10000100, kCFStringEncodingUTF16LE = 0x14000100, kCFStringEncodingUTF32 = 0x0c000100, kCFStringEncodingUTF32BE = 0x18000100, kCFStringEncodingUTF32LE = 0x1c000100 } enum { kCFCompareCaseInsensitive = 1, kCFCompareBackwards = 4, kCFCompareAnchored = 8, kCFCompareNonliteral = 16, kCFCompareLocalized = 32, kCFCompareNumerically = 64, kCFCompareDiacriticInsensitive = 128, kCFCompareWidthInsensitive = 256, kCFCompareForcedOrdering = 512 } enum { kCFStringNormalizationFormD = 0, kCFStringNormalizationFormKD, kCFStringNormalizationFormC, kCFStringNormalizationFormKC } struct CFStringInlineBuffer { wchar* buffer; CFStringRef theString; wchar* directBuffer; CFRange rangeToBuffer; int bufferedRangeStart; int bufferedRangeEnd; } extern (C) { uint CFStringGetTypeID (); CFStringRef CFStringCreateWithPascalString (CFAllocatorRef alloc, char* pStr, uint encoding); CFStringRef CFStringCreateWithCString (CFAllocatorRef alloc, char* cStr, uint encoding); CFStringRef CFStringCreateWithBytes (CFAllocatorRef alloc, char* bytes, int numBytes, uint encoding, ubyte isExternalRepresentation); CFStringRef CFStringCreateWithCharacters (CFAllocatorRef alloc, wchar* chars, int numChars); CFStringRef CFStringCreateWithPascalStringNoCopy (CFAllocatorRef alloc, char* pStr, uint encoding, CFAllocatorRef contentsDeallocator); CFStringRef CFStringCreateWithCStringNoCopy (CFAllocatorRef alloc, char* cStr, uint encoding, CFAllocatorRef contentsDeallocator); CFStringRef CFStringCreateWithBytesNoCopy (CFAllocatorRef alloc, char* bytes, int numBytes, uint encoding, ubyte isExternalRepresentation, CFAllocatorRef contentsDeallocator); CFStringRef CFStringCreateWithCharactersNoCopy (CFAllocatorRef alloc, wchar* chars, int numChars, CFAllocatorRef contentsDeallocator); CFStringRef CFStringCreateWithSubstring (CFAllocatorRef alloc, CFStringRef str, CFRange range); CFStringRef CFStringCreateCopy (CFAllocatorRef alloc, CFStringRef theString); CFStringRef CFStringCreateWithFormat (CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, ...); CFStringRef CFStringCreateWithFormatAndArguments (CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, char* arguments); CFMutableStringRef CFStringCreateMutable (CFAllocatorRef alloc, int maxLength); CFMutableStringRef CFStringCreateMutableCopy (CFAllocatorRef alloc, int maxLength, CFStringRef theString); CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy (CFAllocatorRef alloc, wchar* chars, int numChars, int capacity, CFAllocatorRef externalCharactersAllocator); int CFStringGetLength (CFStringRef theString); wchar CFStringGetCharacterAtIndex (CFStringRef theString, int idx); void CFStringGetCharacters (CFStringRef theString, CFRange range, wchar* buffer); ubyte CFStringGetPascalString (CFStringRef theString, char* buffer, int bufferSize, uint encoding); ubyte CFStringGetCString (CFStringRef theString, char* buffer, int bufferSize, uint encoding); char* CFStringGetPascalStringPtr (CFStringRef theString, uint encoding); char* CFStringGetCStringPtr (CFStringRef theString, uint encoding); wchar* CFStringGetCharactersPtr (CFStringRef theString); int CFStringGetBytes (CFStringRef theString, CFRange range, uint encoding, ubyte lossByte, ubyte isExternalRepresentation, char* buffer, int maxBufLen, int* usedBufLen); CFStringRef CFStringCreateFromExternalRepresentation (CFAllocatorRef alloc, CFDataRef data, uint encoding); CFDataRef CFStringCreateExternalRepresentation (CFAllocatorRef alloc, CFStringRef theString, uint encoding, ubyte lossByte); uint CFStringGetSmallestEncoding (CFStringRef theString); uint CFStringGetFastestEncoding (CFStringRef theString); uint CFStringGetSystemEncoding (); int CFStringGetMaximumSizeForEncoding (int length, uint encoding); ubyte CFStringGetFileSystemRepresentation (CFStringRef string, char* buffer, int maxBufLen); int CFStringGetMaximumSizeOfFileSystemRepresentation (CFStringRef string); CFStringRef CFStringCreateWithFileSystemRepresentation (CFAllocatorRef alloc, char* buffer); int CFStringCompareWithOptionsAndLocale (CFStringRef theString1, CFStringRef theString2, CFRange rangeToCompare, uint compareOptions, CFLocaleRef locale); int CFStringCompareWithOptions (CFStringRef theString1, CFStringRef theString2, CFRange rangeToCompare, uint compareOptions); int CFStringCompare (CFStringRef theString1, CFStringRef theString2, uint compareOptions); ubyte CFStringFindWithOptionsAndLocale (CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, uint searchOptions, CFLocaleRef locale, CFRange* result); ubyte CFStringFindWithOptions (CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, uint searchOptions, CFRange* result); CFArrayRef CFStringCreateArrayWithFindResults (CFAllocatorRef alloc, CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, uint compareOptions); CFRange CFStringFind (CFStringRef theString, CFStringRef stringToFind, uint compareOptions); ubyte CFStringHasPrefix (CFStringRef theString, CFStringRef prefix); ubyte CFStringHasSuffix (CFStringRef theString, CFStringRef suffix); CFRange CFStringGetRangeOfComposedCharactersAtIndex (CFStringRef theString, int theIndex); ubyte CFStringFindCharacterFromSet (CFStringRef theString, CFCharacterSetRef theSet, CFRange rangeToSearch, uint searchOptions, CFRange* result); void CFStringGetLineBounds (CFStringRef theString, CFRange range, int* lineBeginIndex, int* lineEndIndex, int* contentsEndIndex); void CFStringGetParagraphBounds (CFStringRef string, CFRange range, int* parBeginIndex, int* parEndIndex, int* contentsEndIndex); CFStringRef CFStringCreateByCombiningStrings (CFAllocatorRef alloc, CFArrayRef theArray, CFStringRef separatorString); CFArrayRef CFStringCreateArrayBySeparatingStrings (CFAllocatorRef alloc, CFStringRef theString, CFStringRef separatorString); int CFStringGetIntValue (CFStringRef str); double CFStringGetDoubleValue (CFStringRef str); void CFStringAppend (CFMutableStringRef theString, CFStringRef appendedString); void CFStringAppendCharacters (CFMutableStringRef theString, wchar* chars, int numChars); void CFStringAppendPascalString (CFMutableStringRef theString, char* pStr, uint encoding); void CFStringAppendCString (CFMutableStringRef theString, char* cStr, uint encoding); void CFStringAppendFormat (CFMutableStringRef theString, CFDictionaryRef formatOptions, CFStringRef format, ...); void CFStringAppendFormatAndArguments (CFMutableStringRef theString, CFDictionaryRef formatOptions, CFStringRef format, char* arguments); void CFStringInsert (CFMutableStringRef str, int idx, CFStringRef insertedStr); void CFStringDelete (CFMutableStringRef theString, CFRange range); void CFStringReplace (CFMutableStringRef theString, CFRange range, CFStringRef replacement); void CFStringReplaceAll (CFMutableStringRef theString, CFStringRef replacement); int CFStringFindAndReplace (CFMutableStringRef theString, CFStringRef stringToFind, CFStringRef replacementString, CFRange rangeToSearch, uint compareOptions); void CFStringSetExternalCharactersNoCopy (CFMutableStringRef theString, wchar* chars, int length, int capacity); void CFStringPad (CFMutableStringRef theString, CFStringRef padString, int length, int indexIntoPad); void CFStringTrim (CFMutableStringRef theString, CFStringRef trimString); void CFStringTrimWhitespace (CFMutableStringRef theString); void CFStringLowercase (CFMutableStringRef theString, CFLocaleRef locale); void CFStringUppercase (CFMutableStringRef theString, CFLocaleRef locale); void CFStringCapitalize (CFMutableStringRef theString, CFLocaleRef locale); void CFStringNormalize (CFMutableStringRef theString, int theForm); void CFStringFold (CFMutableStringRef theString, uint theFlags, CFLocaleRef theLocale); ubyte CFStringTransform (CFMutableStringRef string, CFRange* range, CFStringRef transform, ubyte reverse); ubyte CFStringIsEncodingAvailable (uint encoding); uint* CFStringGetListOfAvailableEncodings (); CFStringRef CFStringGetNameOfEncoding (uint encoding); uint CFStringConvertEncodingToNSStringEncoding (uint encoding); uint CFStringConvertNSStringEncodingToEncoding (uint encoding); uint CFStringConvertEncodingToWindowsCodepage (uint encoding); uint CFStringConvertWindowsCodepageToEncoding (uint codepage); uint CFStringConvertIANACharSetNameToEncoding (CFStringRef theString); CFStringRef CFStringConvertEncodingToIANACharSetName (uint encoding); uint CFStringGetMostCompatibleMacStringEncoding (uint encoding); void CFShow (void* obj); void CFShowStr (CFStringRef str); CFStringRef __CFStringMakeConstantString (char* cStr); }