• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

iSightを使ってBooklog,MediaMarkerインポート用CSVファイルを生成するアプリ


Commit MetaInfo

修订版8e4982704f04d53b31a7064de7e5d9e7b5a62ba6 (tree)
时间2011-03-04 23:30:31
作者masakih <masakih@user...>
Commitermasakih

Log Message

[Mod] ファイルエンコードをサブクラスで変更可能にした。

更改概述

差异

--- a/BEBooksExporter.h
+++ b/BEBooksExporter.h
@@ -30,5 +30,6 @@ NSString *tagsString(NSArray *tags);
3030 - (void)buildLines; // send lineForBook: message for each books if needed. you can override for anothor building way.
3131 - (NSString *)lineForBook:(BEBookInformation *)book;
3232 - (NSString *)lineSeparator; // default line sparator is CRLF.
33+- (NSStringEncoding)fileEncoding; // default fileEncoding is NSShiftJISStringEncoding.
3334
3435 @end
--- a/BEBooksExporter.m
+++ b/BEBooksExporter.m
@@ -45,14 +45,6 @@
4545 [books release];
4646 [super dealloc];
4747 }
48-- (void)buildLines
49-{
50- for(BEBookInformation *book in books) {
51- if(book.exported) continue;
52- NSString *line = [self lineForBook:book];
53- if(line) [lines addObject:line];
54- }
55-}
5648 - (BOOL)exportToURL:(NSURL *)url
5749 {
5850 lines = [[NSMutableArray alloc] init];
@@ -63,7 +55,7 @@
6355 [lines release]; lines = nil;
6456 NSError *error = nil;
6557 BOOL isOK = NO;
66- isOK = [string writeToURL:url atomically:YES encoding:NSShiftJISStringEncoding error:&error];
58+ isOK = [string writeToURL:url atomically:YES encoding:[self fileEncoding] error:&error];
6759 if(!isOK) {
6860 NSString *errorString = nil;
6961 if(error) {
@@ -90,7 +82,16 @@ NSString *tagsString(NSArray *tags)
9082 }
9183
9284 // for subclass
85+- (void)buildLines
86+{
87+ for(BEBookInformation *book in books) {
88+ if(book.exported) continue;
89+ NSString *line = [self lineForBook:book];
90+ if(line) [lines addObject:line];
91+ }
92+}
9393 - (NSString *)lineForBook:(BEBookInformation *)book { return nil; }
9494 - (NSString *)lineSeparator { return @"\r\n"; }
95+- (NSStringEncoding)fileEncoding { return NSShiftJISStringEncoding; }
9596
9697 @end