aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-03-26 23:28:27 +0000
committerstuconnolly <stuart02@gmail.com>2009-03-26 23:28:27 +0000
commit3a7dc0b03bc51f46d762e2bbe6d7afdee59288ef (patch)
treeafdf05045c74e6a7f12590a4005a306a76d221e3 /Source/SPStringAdditions.m
parent93dfcc27627fd64c1f6c3124297252298a3f499a (diff)
downloadsequelpro-3a7dc0b03bc51f46d762e2bbe6d7afdee59288ef.tar.gz
sequelpro-3a7dc0b03bc51f46d762e2bbe6d7afdee59288ef.tar.bz2
sequelpro-3a7dc0b03bc51f46d762e2bbe6d7afdee59288ef.zip
Completely redesigned query console that now uses a table view instead of a text view. This should significantly improve import speed, but most importantly resolves the crashes caused by the drawing that was being performed by the text view. Fixes issue #87 and implements #167.
New console provides the following: - Live filtering - Ability to hide message time stamps - Ability to hide SELECT/SHOW statement messages - Ability to copy messages to pasteboard, including multiple messages - Ability to save the current filtered content to a file, with the option to include the message time stamps
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r--Source/SPStringAdditions.m66
1 files changed, 32 insertions, 34 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index a26a878e..74c98b4f 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -24,11 +24,9 @@
@implementation NSString (SPStringAdditions)
-// -------------------------------------------------------------------------------
-// stringForByteSize:
-//
-// Returns a human readable version string of the supplied byte size.
-// -------------------------------------------------------------------------------
+/*
+ * Returns a human readable version string of the supplied byte size.
+ */
+ (NSString *)stringForByteSize:(int)byteSize
{
float size = byteSize;
@@ -139,36 +137,36 @@
}
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
- // -------------------------------------------------------------------------------
- // componentsSeparatedByCharactersInSet:
- // Credit - Greg Hulands <ghulands@mac.com>
- // Needed for 10.4+ compatibility
- // -------------------------------------------------------------------------------
- - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)set // 10.5 adds this to NSString, but we are 10.4+
- {
- NSMutableArray *result = [NSMutableArray array];
- NSScanner *scanner = [NSScanner scannerWithString:self];
- NSString *chunk = nil;
-
- [scanner setCharactersToBeSkipped:nil];
- BOOL sepFound = [scanner scanCharactersFromSet:set intoString:(NSString **)nil]; // skip any preceding separators
-
- if (sepFound) { // if initial separator, start with empty component
- [result addObject:@""];
- }
-
- while ([scanner scanUpToCharactersFromSet:set intoString:&chunk]) {
- [result addObject:chunk];
- sepFound = [scanner scanCharactersFromSet: set intoString: (NSString **) nil];
- }
-
- if (sepFound) { // if final separator, end with empty component
- [result addObject: @""];
- }
-
- result = [result copy];
- return [result autorelease];
+/*
+ * componentsSeparatedByCharactersInSet:
+ * Credit - Greg Hulands <ghulands@mac.com>
+ * Needed for 10.4+ compatibility
+ */
+- (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)set // 10.5 adds this to NSString, but we are 10.4+
+{
+ NSMutableArray *result = [NSMutableArray array];
+ NSScanner *scanner = [NSScanner scannerWithString:self];
+ NSString *chunk = nil;
+
+ [scanner setCharactersToBeSkipped:nil];
+ BOOL sepFound = [scanner scanCharactersFromSet:set intoString:(NSString **)nil]; // skip any preceding separators
+
+ if (sepFound) { // if initial separator, start with empty component
+ [result addObject:@""];
+ }
+
+ while ([scanner scanUpToCharactersFromSet:set intoString:&chunk]) {
+ [result addObject:chunk];
+ sepFound = [scanner scanCharactersFromSet: set intoString: (NSString **) nil];
}
+
+ if (sepFound) { // if final separator, end with empty component
+ [result addObject: @""];
+ }
+
+ result = [result copy];
+ return [result autorelease];
+}
#endif
@end