Revision: 4009
http://skim-app.svn.sourceforge.net/skim-app/?rev=4009&view=rev
Author: hofman
Date: 2008-06-12 05:03:53 -0700 (Thu, 12 Jun 2008)
Log Message:
-----------
Move template support methods that are not essential for the parser to separate
category files for the appropriate classes, and move methods only used by the
parser to the parser files. Rename some methods and refactor getting the
attributed string value.
Modified Paths:
--------------
trunk/NSArray_SKExtensions.m
trunk/NSData_SKExtensions.h
trunk/NSData_SKExtensions.m
trunk/NSScanner_SKExtensions.h
trunk/NSScanner_SKExtensions.m
trunk/NSString_SKExtensions.h
trunk/NSString_SKExtensions.m
trunk/PDFDisplayView_SKExtensions.m
trunk/SKTemplateParser.h
trunk/SKTemplateParser.m
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/NSAttributedString_SKExtensions.h
trunk/NSAttributedString_SKExtensions.m
trunk/NSNumber_SKExtensions.h
trunk/NSNumber_SKExtensions.m
Modified: trunk/NSArray_SKExtensions.m
===================================================================
--- trunk/NSArray_SKExtensions.m 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSArray_SKExtensions.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -43,6 +43,8 @@
@implementation NSArray (SKExtensions)
+#pragma mark Templating support
+
- (NSArray *)arraySortedByPageIndex {
return [self sortedArrayUsingDescriptors:[NSArray
arrayWithObject:[[[NSSortDescriptor alloc]
initWithKey:SKPDFAnnotationPageIndexKey ascending:YES
selector:@selector(compare:)] autorelease]]];
}
Added: trunk/NSAttributedString_SKExtensions.h
===================================================================
--- trunk/NSAttributedString_SKExtensions.h (rev 0)
+++ trunk/NSAttributedString_SKExtensions.h 2008-06-12 12:03:53 UTC (rev
4009)
@@ -0,0 +1,49 @@
+//
+// NSAttributedString_SKExtensions.h
+// Skim
+//
+// Created by Christiaan Hofman on 6/12/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
[EMAIL PROTECTED] NSAttributedString (SKExtensions)
+
+- (NSAttributedString *)accessibilityAttributedString;
+
+- (NSString *)xmlString;
+- (NSData *)RTFRepresentation;
+
[EMAIL PROTECTED]
Added: trunk/NSAttributedString_SKExtensions.m
===================================================================
--- trunk/NSAttributedString_SKExtensions.m (rev 0)
+++ trunk/NSAttributedString_SKExtensions.m 2008-06-12 12:03:53 UTC (rev
4009)
@@ -0,0 +1,63 @@
+//
+// NSAttributedString_SKExtensions.m
+// Skim
+//
+// Created by Christiaan Hofman on 6/12/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSAttributedString_SKExtensions.h"
+#import "NSString_SKExtensions.h"
+
+
[EMAIL PROTECTED] NSAttributedString (SKExtensions)
+
+- (NSAttributedString *)accessibilityAttributedString {
+ NSTextFieldCell *cell = nil;
+ if (cell == nil)
+ cell = [[NSTextFieldCell alloc] init];
+ [cell setAttributedStringValue:self];
+ return [cell
accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute
forParameter:[NSValue valueWithRange:NSMakeRange(0, [self length])]];
+}
+
+#pragma mark Templating support
+
+- (NSString *)xmlString {
+ return [[self string] xmlString];
+}
+
+- (NSData *)RTFRepresentation {
+ return [self RTFFromRange:NSMakeRange(0, [self length])
documentAttributes:nil];
+}
+
[EMAIL PROTECTED]
Modified: trunk/NSData_SKExtensions.h
===================================================================
--- trunk/NSData_SKExtensions.h 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSData_SKExtensions.h 2008-06-12 12:03:53 UTC (rev 4009)
@@ -40,7 +40,11 @@
@interface NSData (SKExtensions)
+
- (unsigned)indexOfBytes:(const void *)patternBytes length:(unsigned
int)patternLength;
- (unsigned)indexOfBytes:(const void *)patternBytes length:(unsigned
int)patternLength options:(int)mask;
- (unsigned)indexOfBytes:(const void *)patternBytes length:(unsigned
int)patternLength options:(int)mask range:(NSRange)searchRange;
+
+- (NSString *)xmlString;
+
@end
Modified: trunk/NSData_SKExtensions.m
===================================================================
--- trunk/NSData_SKExtensions.m 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSData_SKExtensions.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -98,4 +98,20 @@
return NSNotFound;
}
+#pragma mark Templating support
+
+- (NSString *)xmlString {
+ NSData *data = [NSPropertyListSerialization dataFromPropertyList:self
format:NSPropertyListXMLFormat_v1_0 errorDescription:NULL];
+ NSMutableString *string = [[[NSMutableString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
+ int loc = NSMaxRange([string rangeOfString:@"<data>"]);
+ if (loc == NSNotFound)
+ return nil;
+ [string deleteCharactersInRange:NSMakeRange(0, loc)];
+ loc = [string rangeOfString:@"</data>" options:NSBackwardsSearch].location;
+ if (loc == NSNotFound)
+ return nil;
+ [string deleteCharactersInRange:NSMakeRange(loc, [string length] - loc)];
+ return string;
+}
+
@end
Added: trunk/NSNumber_SKExtensions.h
===================================================================
--- trunk/NSNumber_SKExtensions.h (rev 0)
+++ trunk/NSNumber_SKExtensions.h 2008-06-12 12:03:53 UTC (rev 4009)
@@ -0,0 +1,50 @@
+//
+// NSNumber_SKExtensions.h
+// Skim
+//
+// Created by Christiaan Hofman on 6/12/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
[EMAIL PROTECTED] NSNumber (SKExtensions)
+
+- (NSNumber *)numberByAddingOne;
+
+- (NSString *)romanNumeralValue;
+- (NSString *)alphaCounterValue;
+- (NSString *)greekCounterValue;
+
[EMAIL PROTECTED]
Added: trunk/NSNumber_SKExtensions.m
===================================================================
--- trunk/NSNumber_SKExtensions.m (rev 0)
+++ trunk/NSNumber_SKExtensions.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -0,0 +1,106 @@
+//
+// NSNumber_SKExtensions.m
+// Skim
+//
+// Created by Christiaan Hofman on 6/12/08.
+/*
+ This software is Copyright (c) 2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSNumber_SKExtensions.h"
+
+
[EMAIL PROTECTED] NSNumber (SKExtensions)
+
+#pragma mark Templating support
+
+- (NSNumber *)numberByAddingOne {
+ return [NSNumber numberWithInt:[self intValue] + 1];
+}
+
+inline static NSString *romanNumeralForDigit(unsigned digit, NSString *i,
NSString *v, NSString *x) {
+ switch (digit) {
+ case 1: return i;
+ case 2: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", i, i];
+ case 3: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@%@", i,
i, i];
+ case 4: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", i, v];
+ case 5: return v;
+ case 6: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", v, i];
+ case 7: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@%@", v,
i, i];
+ case 8: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@[EMAIL
PROTECTED]@", v, i, i, i];
+ case 9: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", i, x];
+ default: return @"";
+ }
+}
+
+- (NSString *)romanNumeralValue{
+ static NSString *symbols[9] = {@"i", @"v", @"x", @"l", @"c", @"d", @"m",
@"mmm", @""};
+
+ NSMutableString *string = [NSMutableString string];
+ unsigned digit, offset, number = [self unsignedIntValue];
+
+ if (number >= 5000)
+ [NSException raise:@"Roman Numeral Exception" format:@"The number %i
is too big to represent as a roman numeral.", number];
+
+ for (offset = 0; number > 0 && offset < 7; offset += 2) {
+ digit = number % 10;
+ number /= 10;
+ [string insertString:romanNumeralForDigit(digit, symbols[offset],
symbols[offset + 1], symbols[offset + 2]) atIndex:0];
+ }
+ return string;
+}
+
+- (NSString *)alphaCounterValue{
+ NSMutableString *string = [NSMutableString string];
+ unsigned letter, number = [self unsignedIntValue];
+
+ while (number > 0) {
+ letter = number % 26;
+ number /= 26;
+ [string insertString:[NSString stringWithFormat:@"%C", 'a' + letter -
1] atIndex:0];
+ }
+ return string;
+}
+
+- (NSString *)greekCounterValue{
+ NSMutableString *string = [NSMutableString string];
+ unsigned letter, number = [self unsignedIntValue];
+
+ while (number > 0) {
+ letter = number % 24;
+ number /= 24;
+ [string insertString:[NSString stringWithFormat:@"%C", 0x03b1 + letter
- 1] atIndex:0];
+ }
+ return string;
+}
+
[EMAIL PROTECTED]
Modified: trunk/NSScanner_SKExtensions.h
===================================================================
--- trunk/NSScanner_SKExtensions.h 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSScanner_SKExtensions.h 2008-06-12 12:03:53 UTC (rev 4009)
@@ -40,6 +40,8 @@
@interface NSScanner (SKExtensions)
+
- (BOOL)scanCharacter:(unichar *)ch;
- (BOOL)peekCharacter:(unichar *)ch;
+
@end
Modified: trunk/NSScanner_SKExtensions.m
===================================================================
--- trunk/NSScanner_SKExtensions.m 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSScanner_SKExtensions.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -37,6 +37,7 @@
*/
#import "NSScanner_SKExtensions.h"
+#import "NSCharacterSet_SKExtensions.h"
@implementation NSScanner (SKExtensions)
Modified: trunk/NSString_SKExtensions.h
===================================================================
--- trunk/NSString_SKExtensions.h 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSString_SKExtensions.h 2008-06-12 12:03:53 UTC (rev 4009)
@@ -58,15 +58,6 @@
- (NSString *)stringByEscapingParenthesis;
-- (NSRange)rangeOfLeadingEmptyLine;
-- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL;
-- (NSRange)rangeOfLeadingEmptyLineInRange:(NSRange)range;
-- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range;
-- (NSRange)rangeOfTrailingEmptyLine;
-- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL;
-- (NSRange)rangeOfTrailingEmptyLineInRange:(NSRange)range;
-- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range;
-
- (NSString *)typeName;
- (NSString *)rectString;
@@ -99,4 +90,6 @@
- (NSAttributedString *)typeIcon;
+- (NSString *)xmlString;
+
@end
Modified: trunk/NSString_SKExtensions.m
===================================================================
--- trunk/NSString_SKExtensions.m 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/NSString_SKExtensions.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -261,70 +261,6 @@
return [string autorelease];
}
-#pragma mark Empty lines
-
-// whitespace at the beginning of the string up to and including a newline
-- (NSRange)rangeOfLeadingEmptyLine {
- return [self rangeOfLeadingEmptyLineRequiringNewline:YES];
-}
-
-- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL {
- return [self rangeOfLeadingEmptyLineRequiringNewline:requireNL
range:NSMakeRange(0, [self length])];
-}
-
-- (NSRange)rangeOfLeadingEmptyLineInRange:(NSRange)range {
- return [self rangeOfLeadingEmptyLineRequiringNewline:YES range:range];
-}
-
-- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range {
- NSRange firstCharRange = [self rangeOfCharacterFromSet:[NSCharacterSet
nonWhitespaceCharacterSet] options:0 range:range];
- NSRange wsRange = NSMakeRange(NSNotFound, 0);
- unsigned int start = range.location;
- if (firstCharRange.location == NSNotFound) {
- if (requireNL == NO)
- wsRange = range;
- } else {
- unichar firstChar = [self characterAtIndex:firstCharRange.location];
- unsigned int rangeEnd = NSMaxRange(firstCharRange);
- if([[NSCharacterSet newlineCharacterSet] characterIsMember:firstChar])
{
- if (firstChar == '\r' && rangeEnd < NSMaxRange(range) && [self
characterAtIndex:rangeEnd] == '\n')
- wsRange = NSMakeRange(start, rangeEnd + 1 - start);
- else
- wsRange = NSMakeRange(start, rangeEnd - start);
- }
- }
- return wsRange;
-}
-
-// whitespace at the end of the string after a newline
-- (NSRange)rangeOfTrailingEmptyLine {
- return [self rangeOfTrailingEmptyLineRequiringNewline:YES];
-}
-
-- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL {
- return [self rangeOfTrailingEmptyLineRequiringNewline:requireNL
range:NSMakeRange(0, [self length])];
-}
-
-- (NSRange)rangeOfTrailingEmptyLineInRange:(NSRange)range {
- return [self rangeOfTrailingEmptyLineRequiringNewline:YES range:range];
-}
-
-- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range {
- NSRange lastCharRange = [self rangeOfCharacterFromSet:[NSCharacterSet
nonWhitespaceCharacterSet] options:NSBackwardsSearch range:range];
- NSRange wsRange = NSMakeRange(NSNotFound, 0);
- unsigned int end = NSMaxRange(range);
- if (lastCharRange.location == NSNotFound) {
- if (requireNL == NO)
- wsRange = range;
- } else {
- unichar lastChar = [self characterAtIndex:lastCharRange.location];
- unsigned int rangeEnd = NSMaxRange(lastCharRange);
- if ([[NSCharacterSet newlineCharacterSet] characterIsMember:lastChar])
- wsRange = NSMakeRange(rangeEnd, end - rangeEnd);
- }
- return wsRange;
-}
-
#pragma mark Templating support
- (NSString *)typeName {
@@ -492,4 +428,18 @@
return attrString;
}
+- (NSString *)xmlString {
+ NSData *data = [NSPropertyListSerialization dataFromPropertyList:self
format:NSPropertyListXMLFormat_v1_0 errorDescription:NULL];
+ NSMutableString *string = [[[NSMutableString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
+ int loc = NSMaxRange([string rangeOfString:@"<string>"]);
+ if (loc == NSNotFound)
+ return self;
+ [string deleteCharactersInRange:NSMakeRange(0, loc)];
+ loc = [string rangeOfString:@"</string>"
options:NSBackwardsSearch].location;
+ if (loc == NSNotFound)
+ return self;
+ [string deleteCharactersInRange:NSMakeRange(loc, [string length] - loc)];
+ return string;
+}
+
@end
Modified: trunk/PDFDisplayView_SKExtensions.m
===================================================================
--- trunk/PDFDisplayView_SKExtensions.m 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/PDFDisplayView_SKExtensions.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -39,6 +39,7 @@
#import "PDFDisplayView_SKExtensions.h"
#import "SKPDFView.h"
#import "PDFAnnotation_SKExtensions.h"
+#import "NSAttributedString_SKExtensions.h"
#import "SKPDFDocument.h"
#import "SKUtilities.h"
@@ -63,11 +64,6 @@
@end
[EMAIL PROTECTED] NSAttributedString (SKExtensions)
-- (NSAttributedString *)accessibilityAttributedString;
[EMAIL PROTECTED]
-
-
@implementation PDFDisplayView (SKExtensions)
static IMP originalResetCursorRects = NULL;
@@ -285,16 +281,3 @@
}
@end
-
-
[EMAIL PROTECTED] NSAttributedString (SKExtensions)
-
-- (NSAttributedString *)accessibilityAttributedString {
- NSTextFieldCell *cell = nil;
- if (cell == nil)
- cell = [[NSTextFieldCell alloc] init];
- [cell setAttributedStringValue:self];
- return [cell
accessibilityAttributeValue:NSAccessibilityAttributedStringForRangeParameterizedAttribute
forParameter:[NSValue valueWithRange:NSMakeRange(0, [self length])]];
-}
-
[EMAIL PROTECTED]
Modified: trunk/SKTemplateParser.h
===================================================================
--- trunk/SKTemplateParser.h 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/SKTemplateParser.h 2008-06-12 12:03:53 UTC (rev 4009)
@@ -51,39 +51,39 @@
@end
+#pragma mark -
@interface NSObject (SKTemplateParser)
-- (NSString *)stringDescription;
+
- (BOOL)isNotEmpty;
+
- (id)safeValueForKeyPath:(NSString *)keyPath;
+- (id)templateValueForKeyPath:(NSString *)keyPath;
+
+- (NSString *)templateStringValue;
+- (NSAttributedString
*)templateAttributedStringValueWithAttributes:(NSDictionary *)attributes;
+
@end
+#pragma mark -
@interface NSScanner (SKTemplateParser)
+
- (BOOL)scanEmptyLine;
[EMAIL PROTECTED]
-
[EMAIL PROTECTED] NSAttributedString (SKTemplateParser)
-- (id)initWithAttributedString:(NSAttributedString *)attributedString
attributes:(NSDictionary *)attributes;
-- (NSString *)xmlString;
-- (NSData *)RTFRepresentation;
@end
+#pragma mark -
@interface NSString (SKTemplateParser)
-- (NSString *)xmlString;
[EMAIL PROTECTED]
+- (NSRange)rangeOfLeadingEmptyLine;
+- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL;
+- (NSRange)rangeOfLeadingEmptyLineInRange:(NSRange)range;
+- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range;
+- (NSRange)rangeOfTrailingEmptyLine;
+- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL;
+- (NSRange)rangeOfTrailingEmptyLineInRange:(NSRange)range;
+- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range;
[EMAIL PROTECTED] NSNumber (SKTemplateParser)
-- (NSNumber *)numberByAddingOne;
-- (NSString *)romanNumeralValue;
-- (NSString *)alphaCounterValue;
-- (NSString *)greekCounterValue;
@end
-
-
[EMAIL PROTECTED] NSData (SKTemplateParser)
-- (NSString *)xmlString;
[EMAIL PROTECTED]
Modified: trunk/SKTemplateParser.m
===================================================================
--- trunk/SKTemplateParser.m 2008-06-12 00:04:11 UTC (rev 4008)
+++ trunk/SKTemplateParser.m 2008-06-12 12:03:53 UTC (rev 4009)
@@ -37,9 +37,9 @@
*/
#import "SKTemplateParser.h"
+#import "SKTag.h"
#import "NSCharacterSet_SKExtensions.h"
#import "NSString_SKExtensions.h"
-#import "SKTag.h"
#import "SKUtilities.h"
#define START_TAG_OPEN_DELIM @"<$"
@@ -434,15 +434,15 @@
if ([keyPath hasPrefix:@"#"]) {
keyValue = [NSNumber numberWithInt:anIndex];
if ([keyPath hasPrefix:@"#."] && [keyPath length] > 2)
- keyValue = [keyValue safeValueForKeyPath:[keyPath
substringFromIndex:2]];
+ keyValue = [keyValue templateValueForKeyPath:[keyPath
substringFromIndex:2]];
} else {
- keyValue = [object safeValueForKeyPath:keyPath];
+ keyValue = [object templateValueForKeyPath:keyPath];
}
if (type == SKValueTagType) {
if (keyValue)
- [result appendString:[keyValue stringDescription]];
+ [result appendString:[keyValue templateStringValue]];
} else if (type == SKCollectionTagType) {
@@ -473,22 +473,22 @@
for (i = 0; i < count; i++) {
matchString = [matchStrings objectAtIndex:i];
if ([matchString hasPrefix:@"$"]) {
- matchString = [[object
safeValueForKeyPath:[matchString substringFromIndex:1]] stringDescription];
+ matchString = [[object
templateValueForKeyPath:[matchString substringFromIndex:1]]
templateStringValue];
if (matchString == nil)
matchString = @"";
}
switch ([tag matchType]) {
case SKConditionTagMatchEqual:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
caseInsensitiveCompare:matchString] == NSOrderedSame;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
caseInsensitiveCompare:matchString] == NSOrderedSame;
break;
case SKConditionTagMatchContain:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
rangeOfString:matchString options:NSCaseInsensitiveSearch].location !=
NSNotFound;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
rangeOfString:matchString options:NSCaseInsensitiveSearch].location !=
NSNotFound;
break;
case SKConditionTagMatchSmaller:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
break;
case SKConditionTagMatchSmallerOrEqual:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
break;
default:
isMatch = [keyValue isNotEmpty];
@@ -751,22 +751,15 @@
if ([keyPath hasPrefix:@"#"]) {
keyValue = [NSNumber numberWithInt:anIndex];
if ([keyPath hasPrefix:@"#."] && [keyPath length] > 2)
- keyValue = [keyValue safeValueForKeyPath:[keyPath
substringFromIndex:2]];
+ keyValue = [keyValue templateValueForKeyPath:[keyPath
substringFromIndex:2]];
} else {
- keyValue = [object safeValueForKeyPath:keyPath];
+ keyValue = [object templateValueForKeyPath:keyPath];
}
if (type == SKValueTagType) {
- if (keyValue) {
- if ([keyValue isKindOfClass:[NSAttributedString class]]) {
- tmpAttrStr = [[NSAttributedString alloc]
initWithAttributedString:keyValue attributes:[(SKRichValueTag *)tag
attributes]];
- } else {
- tmpAttrStr = [[NSAttributedString alloc]
initWithString:[keyValue stringDescription] attributes:[(SKRichValueTag *)tag
attributes]];
- }
- [result appendAttributedString:tmpAttrStr];
- [tmpAttrStr release];
- }
+ if (keyValue)
+ [result appendAttributedString:[keyValue
templateAttributedStringValueWithAttributes:[(SKRichValueTag *)tag
attributes]]];
} else if (type == SKCollectionTagType) {
@@ -799,22 +792,22 @@
for (i = 0; i < count; i++) {
matchString = [matchStrings objectAtIndex:i];
if ([matchString hasPrefix:@"$"]) {
- matchString = [[object
safeValueForKeyPath:[matchString substringFromIndex:1]] stringDescription];
+ matchString = [[object
templateValueForKeyPath:[matchString substringFromIndex:1]]
templateStringValue];
if (matchString == nil)
matchString = @"";
}
switch ([tag matchType]) {
case SKConditionTagMatchEqual:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
caseInsensitiveCompare:matchString] == NSOrderedSame;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
caseInsensitiveCompare:matchString] == NSOrderedSame;
break;
case SKConditionTagMatchContain:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
rangeOfString:matchString options:NSCaseInsensitiveSearch].location !=
NSNotFound;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
rangeOfString:matchString options:NSCaseInsensitiveSearch].location !=
NSNotFound;
break;
case SKConditionTagMatchSmaller:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
break;
case SKConditionTagMatchSmallerOrEqual:
- isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue stringDescription]
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
+ isMatch = [matchString isEqualToString:@""] ? NO
== [keyValue isNotEmpty] : [[keyValue templateStringValue]
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
break;
default:
isMatch = [keyValue isNotEmpty];
@@ -849,25 +842,22 @@
@implementation NSObject (SKTemplateParser)
-- (NSString *)stringDescription {
- NSString *description = nil;
- if ([self respondsToSelector:@selector(stringValue)])
- description = [self performSelector:@selector(stringValue)];
- return description ? description : [self description];
-}
-
- (BOOL)isNotEmpty {
+ if ([self respondsToSelector:@selector(count)])
+ return [(id)self count] > 0;
+ if ([self respondsToSelector:@selector(length)])
+ return [(id)self length] > 0;
return YES;
}
-- (id)valueForKeyPathOrNil:(NSString *)keyPath {
+- (id)safeValueForKeyPath:(NSString *)keyPath {
id value = nil;
@try{ value = [self valueForKeyPath:keyPath]; }
@catch (id exception) { value = nil; }
return value;
}
-- (id)safeValueForKeyPath:(NSString *)keyPath {
+- (id)templateValueForKeyPath:(NSString *)keyPath {
unsigned int atIndex = [keyPath rangeOfString:@"@"].location;
if (atIndex != NSNotFound) {
unsigned int dotIndex = [keyPath rangeOfString:@"." options:0
range:NSMakeRange(atIndex + 1, [keyPath length] - atIndex - 1)].location;
@@ -876,12 +866,25 @@
if (arrayOperators == nil)
arrayOperators = [[NSSet alloc] initWithObjects:@"@avg",
@"@max", @"@min", @"@sum", @"@distinctUnionOfArrays",
@"@distinctUnionOfObjects", @"@distinctUnionOfSets", @"@unionOfArrays",
@"@unionOfObjects", @"@unionOfSets", nil];
if ([arrayOperators containsObject:[keyPath
substringWithRange:NSMakeRange(atIndex, dotIndex - atIndex)]] == NO)
- return [[self valueForKeyPathOrNil:[keyPath
substringToIndex:dotIndex]] safeValueForKeyPath:[keyPath
substringFromIndex:dotIndex + 1]];
+ return [[self safeValueForKeyPath:[keyPath
substringToIndex:dotIndex]] templateValueForKeyPath:[keyPath
substringFromIndex:dotIndex + 1]];
}
}
- return [self valueForKeyPathOrNil:keyPath];
+ return [self safeValueForKeyPath:keyPath];
}
+- (NSString *)templateStringValue {
+ NSString *description = nil;
+ if ([self respondsToSelector:@selector(stringValue)])
+ description = [self performSelector:@selector(stringValue)];
+ if ([self respondsToSelector:@selector(string)])
+ description = [self performSelector:@selector(string)];
+ return description ? description : [self description];
+}
+
+- (NSAttributedString
*)templateAttributedStringValueWithAttributes:(NSDictionary *)attributes {
+ return [[[NSAttributedString alloc] initWithString:[self
templateStringValue] attributes:attributes] autorelease];
+}
+
@end
#pragma mark -
@@ -915,195 +918,116 @@
#pragma mark -
[EMAIL PROTECTED] NSAttributedString (SKTemplateParser)
[EMAIL PROTECTED]
+
@implementation NSAttributedString (SKTemplateParser)
-- (id)initWithAttributedString:(NSAttributedString *)attributedString
attributes:(NSDictionary *)attributes {
- [[self init] release];
- NSMutableAttributedString *tmpStr = [attributedString mutableCopy];
- unsigned idx = 0, length = [attributedString length];
+- (NSAttributedString
*)templateAttributedStringValueWithAttributes:(NSDictionary *)attributes {
+ NSMutableAttributedString *attributedString = [self mutableCopy];
+ unsigned idx = 0, length = [self length];
NSRange range = NSMakeRange(0, length);
NSDictionary *attrs;
- [tmpStr addAttributes:attributes range:range];
+ [attributedString addAttributes:attributes range:range];
while (idx < length) {
- attrs = [attributedString attributesAtIndex:idx effectiveRange:&range];
+ attrs = [self attributesAtIndex:idx effectiveRange:&range];
if (range.length > 0) {
- [tmpStr addAttributes:attrs range:range];
+ [attributedString addAttributes:attrs range:range];
idx = NSMaxRange(range);
} else idx++;
}
- [tmpStr fixAttributesInRange:NSMakeRange(0, length)];
- self = [tmpStr copy];
- [tmpStr release];
- return self;
+ [attributedString fixAttributesInRange:NSMakeRange(0, length)];
+ return [attributedString autorelease];
}
-- (NSString *)stringDescription {
- return [self string];
-}
[EMAIL PROTECTED]
-- (BOOL)isNotEmpty {
- return [self length] > 0;
-}
+#pragma mark -
-- (NSString *)xmlString {
- return [[self string] xmlString];
-}
-
-- (NSData *)RTFRepresentation {
- return [self RTFFromRange:NSMakeRange(0, [self length])
documentAttributes:nil];
-}
-
[EMAIL PROTECTED] NSData (SKTemplateParser)
@end
-#pragma mark
-
@implementation NSData (SKTemplateParser)
-
-- (NSString *)stringDescription {
- return [[[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding]
autorelease];
-}
-
-- (NSString *)xmlString {
- NSData *data = [NSPropertyListSerialization dataFromPropertyList:self
format:NSPropertyListXMLFormat_v1_0 errorDescription:NULL];
- NSMutableString *string = [[[NSMutableString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
- int loc = NSMaxRange([string rangeOfString:@"<data>"]);
- if (loc == NSNotFound)
- return nil;
- [string deleteCharactersInRange:NSMakeRange(0, loc)];
- loc = [string rangeOfString:@"</data>" options:NSBackwardsSearch].location;
- if (loc == NSNotFound)
- return nil;
- [string deleteCharactersInRange:NSMakeRange(loc, [string length] - loc)];
- return string;
-}
-
+- (NSString *)templateStringValue { return [[[NSString alloc]
initWithData:self encoding:NSUTF8StringEncoding] autorelease]; }
@end
#pragma mark -
@implementation NSString (SKTemplateParser)
-- (NSString *)stringDescription{
- return self;
-}
+- (NSString *)templateStringValue{ return self; }
-- (BOOL)isNotEmpty {
- return [self isEqualToString:@""] == NO;
-}
+#pragma mark Empty lines
-- (NSString *)xmlString {
- NSData *data = [NSPropertyListSerialization dataFromPropertyList:self
format:NSPropertyListXMLFormat_v1_0 errorDescription:NULL];
- NSMutableString *string = [[[NSMutableString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
- int loc = NSMaxRange([string rangeOfString:@"<string>"]);
- if (loc == NSNotFound)
- return self;
- [string deleteCharactersInRange:NSMakeRange(0, loc)];
- loc = [string rangeOfString:@"</string>"
options:NSBackwardsSearch].location;
- if (loc == NSNotFound)
- return self;
- [string deleteCharactersInRange:NSMakeRange(loc, [string length] - loc)];
- return string;
+// whitespace at the beginning of the string up to and including a newline
+- (NSRange)rangeOfLeadingEmptyLine {
+ return [self rangeOfLeadingEmptyLineRequiringNewline:YES];
}
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] NSNumber (SKTemplateParser)
-
-- (NSNumber *)numberByAddingOne {
- return [NSNumber numberWithInt:[self intValue] + 1];
+- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL {
+ return [self rangeOfLeadingEmptyLineRequiringNewline:requireNL
range:NSMakeRange(0, [self length])];
}
-- (BOOL)isNotEmpty {
- return [self isEqualToNumber:[NSNumber numberWithBool:NO]] == NO && [self
isEqualToNumber:[NSNumber numberWithInt:0]] == NO;
+- (NSRange)rangeOfLeadingEmptyLineInRange:(NSRange)range {
+ return [self rangeOfLeadingEmptyLineRequiringNewline:YES range:range];
}
-inline static NSString *romanNumeralForDigit(unsigned digit, NSString *i,
NSString *v, NSString *x) {
- switch (digit) {
- case 1: return i;
- case 2: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", i, i];
- case 3: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@%@", i,
i, i];
- case 4: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", i, v];
- case 5: return v;
- case 6: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", v, i];
- case 7: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@%@", v,
i, i];
- case 8: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@[EMAIL
PROTECTED]@", v, i, i, i];
- case 9: return [NSString stringWithFormat:@"[EMAIL PROTECTED]@", i, x];
- default: return @"";
+- (NSRange)rangeOfLeadingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range {
+ NSRange firstCharRange = [self rangeOfCharacterFromSet:[NSCharacterSet
nonWhitespaceCharacterSet] options:0 range:range];
+ NSRange wsRange = NSMakeRange(NSNotFound, 0);
+ unsigned int start = range.location;
+ if (firstCharRange.location == NSNotFound) {
+ if (requireNL == NO)
+ wsRange = range;
+ } else {
+ unichar firstChar = [self characterAtIndex:firstCharRange.location];
+ unsigned int rangeEnd = NSMaxRange(firstCharRange);
+ if([[NSCharacterSet newlineCharacterSet] characterIsMember:firstChar])
{
+ if (firstChar == '\r' && rangeEnd < NSMaxRange(range) && [self
characterAtIndex:rangeEnd] == '\n')
+ wsRange = NSMakeRange(start, rangeEnd + 1 - start);
+ else
+ wsRange = NSMakeRange(start, rangeEnd - start);
+ }
}
+ return wsRange;
}
-- (NSString *)romanNumeralValue{
- static NSString *symbols[9] = {@"i", @"v", @"x", @"l", @"c", @"d", @"m",
@"mmm", @""};
-
- NSMutableString *string = [NSMutableString string];
- unsigned digit, offset, number = [self unsignedIntValue];
-
- if (number >= 5000)
- [NSException raise:@"Roman Numeral Exception" format:@"The number %i
is too big to represent as a roman numeral.", number];
-
- for (offset = 0; number > 0 && offset < 7; offset += 2) {
- digit = number % 10;
- number /= 10;
- [string insertString:romanNumeralForDigit(digit, symbols[offset],
symbols[offset + 1], symbols[offset + 2]) atIndex:0];
- }
- return string;
+// whitespace at the end of the string after a newline
+- (NSRange)rangeOfTrailingEmptyLine {
+ return [self rangeOfTrailingEmptyLineRequiringNewline:YES];
}
-- (NSString *)alphaCounterValue{
- NSMutableString *string = [NSMutableString string];
- unsigned letter, number = [self unsignedIntValue];
-
- while (number > 0) {
- letter = number % 26;
- number /= 26;
- [string insertString:[NSString stringWithFormat:@"%C", 'a' + letter -
1] atIndex:0];
- }
- return string;
+- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL {
+ return [self rangeOfTrailingEmptyLineRequiringNewline:requireNL
range:NSMakeRange(0, [self length])];
}
-- (NSString *)greekCounterValue{
- NSMutableString *string = [NSMutableString string];
- unsigned letter, number = [self unsignedIntValue];
-
- while (number > 0) {
- letter = number % 24;
- number /= 24;
- [string insertString:[NSString stringWithFormat:@"%C", 0x03b1 + letter
- 1] atIndex:0];
- }
- return string;
+- (NSRange)rangeOfTrailingEmptyLineInRange:(NSRange)range {
+ return [self rangeOfTrailingEmptyLineRequiringNewline:YES range:range];
}
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] NSArray (SKTemplateParser)
-
-- (BOOL)isNotEmpty {
- return [self count] > 0;
+- (NSRange)rangeOfTrailingEmptyLineRequiringNewline:(BOOL)requireNL
range:(NSRange)range {
+ NSRange lastCharRange = [self rangeOfCharacterFromSet:[NSCharacterSet
nonWhitespaceCharacterSet] options:NSBackwardsSearch range:range];
+ NSRange wsRange = NSMakeRange(NSNotFound, 0);
+ unsigned int end = NSMaxRange(range);
+ if (lastCharRange.location == NSNotFound) {
+ if (requireNL == NO)
+ wsRange = range;
+ } else {
+ unichar lastChar = [self characterAtIndex:lastCharRange.location];
+ unsigned int rangeEnd = NSMaxRange(lastCharRange);
+ if ([[NSCharacterSet newlineCharacterSet] characterIsMember:lastChar])
+ wsRange = NSMakeRange(rangeEnd, end - rangeEnd);
+ }
+ return wsRange;
}
@end
#pragma mark -
[EMAIL PROTECTED] NSDictionary (SKTemplateParser)
-
-- (BOOL)isNotEmpty {
- return [self count] > 0;
-}
-
[EMAIL PROTECTED] NSNumber (SKTemplateParser)
@end
-#pragma mark -
-
[EMAIL PROTECTED] NSSet (SKTemplateParser)
-
-- (BOOL)isNotEmpty
-{
- return [self count] > 0;
-}
-
[EMAIL PROTECTED] NSNumber (SKTemplateParser)
+- (BOOL)isNotEmpty { return [self isEqualToNumber:[NSNumber
numberWithBool:NO]] == NO && [self isEqualToNumber:[NSNumber numberWithInt:0]]
== NO; }
@end
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2008-06-12 00:04:11 UTC (rev
4008)
+++ trunk/Skim.xcodeproj/project.pbxproj 2008-06-12 12:03:53 UTC (rev
4009)
@@ -80,6 +80,8 @@
CE31A6180C01FC45003612A9 /* SKDocumentController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE31A6160C01FC45003612A9 /*
SKDocumentController.m */; };
CE327A460C11BF6700DB4BEB /* NoteTypeSheet.nib in Resources */ =
{isa = PBXBuildFile; fileRef = CE327A440C11BF6700DB4BEB /* NoteTypeSheet.nib
*/; };
CE3400AC0E0034DF00A7FFE6 /* NSMenu_SKExtensions.m in Sources */
= {isa = PBXBuildFile; fileRef = CE3400AB0E0034DF00A7FFE6 /*
NSMenu_SKExtensions.m */; };
+ CE3401E00E01378A00A7FFE6 /* NSAttributedString_SKExtensions.m
in Sources */ = {isa = PBXBuildFile; fileRef = CE3401DF0E01378A00A7FFE6 /*
NSAttributedString_SKExtensions.m */; };
+ CE3401E60E01388700A7FFE6 /* NSNumber_SKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE3401E50E01388700A7FFE6 /*
NSNumber_SKExtensions.m */; };
CE34FFA80DFF58FB00A7FFE6 /* NSEvent_SKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE34FFA70DFF58FB00A7FFE6 /*
NSEvent_SKExtensions.m */; };
CE380A7B0B834E6200A1B779 /* CameraCursor.tiff in Resources */ =
{isa = PBXBuildFile; fileRef = CE380A7A0B834E6100A1B779 /* CameraCursor.tiff
*/; };
CE38ECD30B8093B200A1B779 /* NSString_SKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE38ECD20B8093B200A1B779 /*
NSString_SKExtensions.m */; };
@@ -484,6 +486,10 @@
CE327A4A0C11BF9000DB4BEB /* Italian */ = {isa =
PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path =
Italian.lproj/NoteTypeSheet.nib; sourceTree = "<group>"; };
CE3400AA0E0034DF00A7FFE6 /* NSMenu_SKExtensions.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
NSMenu_SKExtensions.h; sourceTree = "<group>"; };
CE3400AB0E0034DF00A7FFE6 /* NSMenu_SKExtensions.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= NSMenu_SKExtensions.m; sourceTree = "<group>"; };
+ CE3401DE0E01378A00A7FFE6 /* NSAttributedString_SKExtensions.h
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.h; path = NSAttributedString_SKExtensions.h; sourceTree =
"<group>"; };
+ CE3401DF0E01378A00A7FFE6 /* NSAttributedString_SKExtensions.m
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = NSAttributedString_SKExtensions.m; sourceTree =
"<group>"; };
+ CE3401E40E01388700A7FFE6 /* NSNumber_SKExtensions.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
NSNumber_SKExtensions.h; sourceTree = "<group>"; };
+ CE3401E50E01388700A7FFE6 /* NSNumber_SKExtensions.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= NSNumber_SKExtensions.m; sourceTree = "<group>"; };
CE34FFA60DFF58FB00A7FFE6 /* NSEvent_SKExtensions.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
NSEvent_SKExtensions.h; sourceTree = "<group>"; };
CE34FFA70DFF58FB00A7FFE6 /* NSEvent_SKExtensions.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= NSEvent_SKExtensions.m; sourceTree = "<group>"; };
CE380A7A0B834E6100A1B779 /* CameraCursor.tiff */ = {isa =
PBXFileReference; lastKnownFileType = image.tiff; name = CameraCursor.tiff;
path = Images/CameraCursor.tiff; sourceTree = "<group>"; };
@@ -1110,6 +1116,8 @@
children = (
CEBF85DF0CCE2DE70057A050 /*
NSAffineTransform_SKExtensions.h */,
CEBF85E00CCE2DE70057A050 /*
NSAffineTransform_SKExtensions.m */,
+ CE3401DE0E01378A00A7FFE6 /*
NSAttributedString_SKExtensions.h */,
+ CE3401DF0E01378A00A7FFE6 /*
NSAttributedString_SKExtensions.m */,
CE41B2A40C08CFA900E36EB7 /*
NSArray_SKExtensions.h */,
CE41B2A50C08CFA900E36EB7 /*
NSArray_SKExtensions.m */,
CE1E30260BDB9D8E0011D9DD /*
NSCharacterSet_SKExtensions.h */,
@@ -1124,6 +1132,8 @@
CE5BEA170C7C635400EBDCF7 /*
NSGeometry_SKExtensions.m */,
CE0EB4D40DD054DC0034DF92 /*
NSInvocation_SKExtensions.h */,
CE0EB4D50DD054DC0034DF92 /*
NSInvocation_SKExtensions.m */,
+ CE3401E40E01388700A7FFE6 /*
NSNumber_SKExtensions.h */,
+ CE3401E50E01388700A7FFE6 /*
NSNumber_SKExtensions.m */,
CE6C03EE0BEDF759007BF0B5 /*
NSParagraphStyle_SKExtensions.h */,
CE6C03EF0BEDF759007BF0B5 /*
NSParagraphStyle_SKExtensions.m */,
CE1E301A0BDB9D5C0011D9DD /*
NSScanner_SKExtensions.h */,
@@ -2073,6 +2083,8 @@
CE4645910DF8140200CFD8D2 /*
SKNumberArrayFormatter.m in Sources */,
CE34FFA80DFF58FB00A7FFE6 /*
NSEvent_SKExtensions.m in Sources */,
CE3400AC0E0034DF00A7FFE6 /*
NSMenu_SKExtensions.m in Sources */,
+ CE3401E00E01378A00A7FFE6 /*
NSAttributedString_SKExtensions.m in Sources */,
+ CE3401E60E01388700A7FFE6 /*
NSNumber_SKExtensions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit