|
Wired Foundation
2.0
A foundation framework for the Wired implementation on Mac OS X
|
00001 /* $Id$ */ 00002 00003 /* 00004 * Copyright (c) 2003-2009 Axel Andersson 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00017 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00020 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00023 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00024 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00025 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00026 * POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00029 @class WITextFilter; 00030 00031 @interface NSString(WIFoundation) 00032 00033 + (id)stringWithFormat:(NSString *)format arguments:(va_list)arguments; 00034 + (id)stringWithData:(NSData *)data encoding:(NSStringEncoding)encoding; 00035 + (id)stringWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding; 00036 + (id)stringWithRandomCharactersFromString:(NSString *)string length:(NSUInteger)length; 00037 + (id)UUIDString; 00038 00039 - (NSUInteger)UTF8StringLength; 00040 - (unsigned long long)unsignedLongLongValue; 00041 - (unsigned int)unsignedIntValue; 00042 - (NSUInteger)unsignedIntegerValue; 00043 00044 - (BOOL)containsSubstring:(NSString *)string; 00045 - (BOOL)containsSubstring:(NSString *)string options:(NSUInteger)options; 00046 - (BOOL)containsCharactersFromSet:(NSCharacterSet *)set; 00047 - (BOOL)isComposedOfCharactersFromSet:(NSCharacterSet *)characterSet; 00048 00049 - (NSArray *)componentsSeparatedByCharactersFromSet:(NSCharacterSet *)characterSet; 00050 00051 - (NSString *)stringByReplacingOccurencesOfString:(NSString *)target withString:(NSString *)replacement; 00052 - (NSString *)stringByReplacingOccurencesOfStrings:(NSArray *)targets withString:(NSString *)replacement; 00053 00054 - (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding charactersToLeaveUnescaped:(NSString *)charactersToLeaveUnescaped; 00055 - (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding legalURLCharactersToBeEscaped:(NSString *)legalURLCharactersToBeEscaped; 00056 00057 - (NSString *)stringByReplacingPathExtensionWithExtension:(NSString *)extension; 00058 00059 - (NSString *)stringByApplyingFilter:(WITextFilter *)filter; 00060 00061 - (NSComparisonResult)caseInsensitiveAndNumericCompare:(NSString *)string; 00062 - (NSComparisonResult)finderCompare:(NSString *)string; 00063 00064 @end 00065 00066 00067 @interface NSString(WIStringChecksumming) 00068 00069 - (NSString *)SHA1; 00070 00071 @end 00072 00073 00074 @interface NSString(WIHumanReadableStringFormatting) 00075 00076 + (NSString *)humanReadableStringForTimeInterval:(NSTimeInterval)interval; 00077 + (NSString *)humanReadableStringForSizeInBytes:(unsigned long long)size; 00078 + (NSString *)humanReadableStringForSizeInBytes:(unsigned long long)size withBytes:(BOOL)bytes; 00079 + (NSString *)humanReadableStringForSizeInBits:(unsigned long long)size; 00080 + (NSString *)humanReadableStringForBandwidth:(NSUInteger)speed; 00081 00082 @end 00083 00084 00085 @interface NSString(WIWiredVersionStringFormatting) 00086 00087 - (NSString *)wiredVersion; 00088 00089 @end 00090 00091 00092 @interface NSMutableString(WIFoundation) 00093 00094 - (void)deleteCharactersToIndex:(NSUInteger)index; 00095 - (void)deleteCharactersFromIndex:(NSUInteger)index; 00096 00097 - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement; 00098 - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSUInteger)options; 00099 00100 - (void)trimCharactersInSet:(NSCharacterSet *)characterSet; 00101 00102 - (void)applyFilter:(WITextFilter *)filter; 00103 00104 @end