aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExporter.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPExporter.m')
-rw-r--r--Source/SPExporter.m38
1 files changed, 35 insertions, 3 deletions
diff --git a/Source/SPExporter.m b/Source/SPExporter.m
index 195d900d..ff90853c 100644
--- a/Source/SPExporter.m
+++ b/Source/SPExporter.m
@@ -35,6 +35,7 @@
@implementation SPExporter
@synthesize connection;
+@synthesize serverSupport = serverSupport;
@synthesize exportProgressValue;
@synthesize exportProcessIsRunning;
@synthesize exportUsingLowMemoryBlockingStreaming;
@@ -66,11 +67,31 @@
}
/**
- * Override NSOperation's main() method. This method should never be called as all subclasses should override it.
+ * Override NSOperation's main() method.
+ * This method only creates an autoreleasepool and calls exportOperation
*/
- (void)main
{
- [NSException raise:NSInternalInconsistencyException format:@"Cannot call NSOperation's main() method in SPExpoter, must be overriden in a subclass. See SPExporter.h"];
+ NSAutoreleasePool *pool = nil;
+ @try {
+ pool = [[NSAutoreleasePool alloc] init];
+
+ [self exportOperation];
+ }
+ @catch(NSException *e) {
+ [[NSApp onMainThread] reportException:e]; // will be caught by FeedbackReporter
+ }
+ @finally {
+ [pool release];
+ }
+}
+
+/**
+ * This method should never be called as all subclasses should override it.
+ */
+- (void)exportOperation
+{
+ [NSException raise:NSInternalInconsistencyException format:@"Cannot call %s, must be overriden in a subclass. See SPExporter.h",__PRETTY_FUNCTION__];
}
/**
@@ -95,7 +116,17 @@
exportOutputCompressFile = compress;
- [[[self exportOutputFile] exportFileHandle] setShouldWriteWithCompressionFormat:(compress) ? [self exportOutputCompressionFormat] : SPNoCompression];
+ [[[self exportOutputFile] exportFileHandle] setCompressionFormat:(compress) ? [self exportOutputCompressionFormat] : SPNoCompression];
+}
+
+- (void)writeString:(NSString *)input
+{
+ [[self exportOutputFile] writeData:[input dataUsingEncoding:[self exportOutputEncoding]]];
+}
+
+- (void)writeUTF8String:(NSString *)input
+{
+ [[self exportOutputFile] writeData:[input dataUsingEncoding:NSUTF8StringEncoding]];
}
/**
@@ -105,6 +136,7 @@
{
if (exportData) SPClear(exportData);
if (connection) SPClear(connection);
+ [self setServerSupport:nil];
if (exportOutputFile) SPClear(exportOutputFile);
[super dealloc];