[sword-svn] r2711 - in trunk/bindings/objc: . ObjCSword.xcodeproj cs.lproj src test
mdbergmann at crosswire.org
mdbergmann at crosswire.org
Mon Jul 23 13:49:06 MST 2012
Author: mdbergmann
Date: 2012-07-23 13:49:06 -0700 (Mon, 23 Jul 2012)
New Revision: 2711
Added:
trunk/bindings/objc/cs.lproj/
trunk/bindings/objc/cs.lproj/InfoPlist.strings
Modified:
trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
trunk/bindings/objc/src/SwordBible.h
trunk/bindings/objc/src/SwordBible.mm
trunk/bindings/objc/src/SwordBibleBook.h
trunk/bindings/objc/src/SwordBibleBook.mm
trunk/bindings/objc/src/SwordBibleTextEntry.h
trunk/bindings/objc/src/SwordBibleTextEntry.m
trunk/bindings/objc/src/SwordBook.h
trunk/bindings/objc/src/SwordBook.mm
trunk/bindings/objc/src/SwordDictionary.mm
trunk/bindings/objc/src/SwordInstallSource.mm
trunk/bindings/objc/src/SwordInstallSourceManager.h
trunk/bindings/objc/src/SwordInstallSourceManager.mm
trunk/bindings/objc/src/SwordKey.h
trunk/bindings/objc/src/SwordKey.mm
trunk/bindings/objc/src/SwordListKey.h
trunk/bindings/objc/src/SwordListKey.mm
trunk/bindings/objc/src/SwordLocaleManager.h
trunk/bindings/objc/src/SwordLocaleManager.mm
trunk/bindings/objc/src/SwordManager.h
trunk/bindings/objc/src/SwordManager.mm
trunk/bindings/objc/src/SwordModule.h
trunk/bindings/objc/src/SwordModule.mm
trunk/bindings/objc/src/SwordVerseKey.h
trunk/bindings/objc/src/SwordVerseKey.mm
trunk/bindings/objc/src/SwordVerseManager.mm
trunk/bindings/objc/src/VerseEnumerator.mm
trunk/bindings/objc/test/SwordModuleLongRunTest.mm
trunk/bindings/objc/test/SwordModuleTest.m
Log:
some refactorings and cleanups. also fixed some possible memory leaks.
Modified: trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
===================================================================
--- trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj 2012-07-23 20:49:06 UTC (rev 2711)
@@ -711,6 +711,8 @@
A94EAC08117B28920018B06F /* SwordVerseManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SwordVerseManager.mm; path = src/SwordVerseManager.mm; sourceTree = "<group>"; };
A94EAC09117B28920018B06F /* VerseEnumerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VerseEnumerator.h; path = src/VerseEnumerator.h; sourceTree = "<group>"; };
A94EAC0A117B28920018B06F /* VerseEnumerator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = VerseEnumerator.mm; path = src/VerseEnumerator.mm; sourceTree = "<group>"; };
+ A95043E315BC87F600D89B38 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ A950440315BC87F600D89B38 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A954A80113EE98B30094E3FE /* swdisp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = swdisp.cpp; sourceTree = "<group>"; };
A954A80213EE98B30094E3FE /* swlog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = swlog.cpp; sourceTree = "<group>"; };
A954A80913EE98B30094E3FE /* listkey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = listkey.cpp; sourceTree = "<group>"; };
@@ -3450,6 +3452,7 @@
isa = PBXVariantGroup;
children = (
089C1667FE841158C02AAC07 /* English */,
+ A95043E315BC87F600D89B38 /* cs */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
@@ -3458,6 +3461,7 @@
isa = PBXVariantGroup;
children = (
A9BFB0B013EDF51100032679 /* en */,
+ A950440315BC87F600D89B38 /* cs */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
@@ -3504,7 +3508,7 @@
"-licucore",
);
PRODUCT_NAME = ObjCSword;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
VALID_ARCHS = x86_64;
WARNING_CFLAGS = "-Wall";
WRAPPER_EXTENSION = framework;
@@ -3549,7 +3553,7 @@
"-licucore",
);
PRODUCT_NAME = ObjCSword;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
VALID_ARCHS = x86_64;
WARNING_CFLAGS = "-Wall";
WRAPPER_EXTENSION = framework;
@@ -3566,7 +3570,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
};
name = Debug;
};
@@ -3578,7 +3582,7 @@
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
};
name = Release;
};
@@ -3615,7 +3619,7 @@
"-D_ICU_",
);
PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../include/**/** $(SRCROOT)/dependencies/clucene/** $(SRCROOT)/dependencies/icu/include/**";
VALID_ARCHS = x86_64;
};
@@ -3651,7 +3655,7 @@
"-D_ICU_",
);
PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../include/**/** $(SRCROOT)/dependencies/clucene/** $(SRCROOT)/dependencies/icu/include/**";
VALID_ARCHS = x86_64;
};
@@ -3684,7 +3688,7 @@
"-licucore",
);
PRODUCT_NAME = mod2osis;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -3715,7 +3719,7 @@
"-licucore",
);
PRODUCT_NAME = mod2osis;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -3815,7 +3819,7 @@
SenTestingKit,
);
PRODUCT_NAME = Tests;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
WRAPPER_EXTENSION = octest;
};
name = Debug;
@@ -3842,7 +3846,7 @@
SenTestingKit,
);
PRODUCT_NAME = Tests;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
WRAPPER_EXTENSION = octest;
ZERO_LINK = NO;
};
@@ -3871,7 +3875,7 @@
INFOPLIST_FILE = "Tests/Tests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
WRAPPER_EXTENSION = octest;
};
name = Debug;
@@ -3894,7 +3898,7 @@
INFOPLIST_FILE = "Tests/Tests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
WRAPPER_EXTENSION = octest;
};
name = Release;
@@ -3926,7 +3930,7 @@
"-licucore",
);
PRODUCT_NAME = imp2gbs;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -3957,7 +3961,7 @@
"-licucore",
);
PRODUCT_NAME = imp2gbs;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -3990,7 +3994,7 @@
"-licucore",
);
PRODUCT_NAME = imp2ld;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -4021,7 +4025,7 @@
"-licucore",
);
PRODUCT_NAME = imp2ld;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -4054,7 +4058,7 @@
"-licucore",
);
PRODUCT_NAME = imp2vs;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -4085,7 +4089,7 @@
"-licucore",
);
PRODUCT_NAME = imp2vs;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -4118,7 +4122,7 @@
"-licucore",
);
PRODUCT_NAME = installmgr;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -4149,7 +4153,7 @@
"-licucore",
);
PRODUCT_NAME = installmgr;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -4182,7 +4186,7 @@
"-licucore",
);
PRODUCT_NAME = mod2imp;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -4213,7 +4217,7 @@
"-licucore",
);
PRODUCT_NAME = mod2imp;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -4246,7 +4250,7 @@
"-licucore",
);
PRODUCT_NAME = mod2vpl;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -4277,7 +4281,7 @@
"-licucore",
);
PRODUCT_NAME = mod2vpl;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
@@ -4310,7 +4314,7 @@
"-licucore",
);
PRODUCT_NAME = mod2zmod;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
};
name = Debug;
@@ -4341,7 +4345,7 @@
"-licucore",
);
PRODUCT_NAME = mod2zmod;
- SDKROOT = macosx;
+ SDKROOT = macosx10.7;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
ZERO_LINK = NO;
};
Copied: trunk/bindings/objc/cs.lproj/InfoPlist.strings (from rev 2710, trunk/bindings/objc/English.lproj/InfoPlist.strings)
===================================================================
--- trunk/bindings/objc/cs.lproj/InfoPlist.strings (rev 0)
+++ trunk/bindings/objc/cs.lproj/InfoPlist.strings 2012-07-23 20:49:06 UTC (rev 2711)
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
Modified: trunk/bindings/objc/src/SwordBible.h
===================================================================
--- trunk/bindings/objc/src/SwordBible.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBible.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -57,7 +57,11 @@
- (int)versesForBible;
// Text pulling
-- (SwordBibleTextEntry *)textEntryForKey:(SwordKey *)aKey textType:(TextPullType)aType;
+
+/**
+* @return SwordBibleTextEntry
+*/
+- (SwordModuleTextEntry *)textEntryForKey:(SwordKey *)aKey textType:(TextPullType)aType;
- (NSArray *)strippedTextEntriesForRef:(NSString *)reference context:(int)context;
- (NSArray *)renderedTextEntriesForRef:(NSString *)reference context:(int)context;
/**
Modified: trunk/bindings/objc/src/SwordBible.mm
===================================================================
--- trunk/bindings/objc/src/SwordBible.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBible.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -12,19 +12,16 @@
*/
#import "SwordBible.h"
-#import "SwordModule.h"
#import "SwordManager.h"
#import "SwordBibleBook.h"
#import "SwordListKey.h"
#import "SwordModuleTextEntry.h"
#import "SwordBibleTextEntry.h"
#import "SwordVerseKey.h"
-#import "SwordListKey.h"
using sword::AttributeTypeList;
using sword::AttributeList;
using sword::AttributeValue;
-#include "versemgr.h"
@interface SwordBible ()
@@ -83,25 +80,25 @@
//get parsed simple ref
NSString *first = [SwordBible firstRefName:abbr];
- NSArray *firstbits = [first componentsSeparatedByString:@":"];
+ NSArray *firstBits = [first componentsSeparatedByString:@":"];
//if abbr contains : or . then we are a verse so return a chapter
if([abbr rangeOfString:@":"].location != NSNotFound || [abbr rangeOfString:@"."].location != NSNotFound) {
- return [firstbits objectAtIndex:0];
+ return [firstBits objectAtIndex:0];
}
//otherwise return a book
- firstbits = [first componentsSeparatedByString:@" "];
+ firstBits = [first componentsSeparatedByString:@" "];
- if([firstbits count] > 0) {
- return [firstbits objectAtIndex:0];
+ if([firstBits count] > 0) {
+ return [firstBits objectAtIndex:0];
}
return abbr;
}
/**
- get book index for versekey
+ get book index for verseKey
that is: book number + testament * 100
*/
+ (int)bookIndexForSWKey:(sword::VerseKey *)key {
@@ -133,6 +130,7 @@
}
- (void)dealloc {
+ [books release];
[super dealloc];
}
@@ -149,7 +147,7 @@
for(int i = 0;i < bookCount;i++) {
sword::VerseMgr::Book *book = (sword::VerseMgr::Book *)system->getBook(i);
- SwordBibleBook *bb = [[SwordBibleBook alloc] initWithBook:book];
+ SwordBibleBook *bb = [[[SwordBibleBook alloc] initWithBook:book] autorelease];
[bb setNumber:i+1];
NSString *bookName = [bb name];
@@ -227,7 +225,7 @@
- (int)chaptersForBookName:(NSString *)bookName {
[moduleLock lock];
- int maxChapters = 0;
+ int maxChapters;
sword::VerseKey *key = (sword::VerseKey *)swModule->CreateKey();
(*key) = [bookName UTF8String];
maxChapters = key->getChapterMax();
@@ -279,28 +277,28 @@
}
- (NSString *)moduleIntroduction {
- NSString *ret = @"";
+ NSString *ret;
// save key
- SwordVerseKey *save = [self getKeyCopy];
+ SwordVerseKey *save = [(SwordVerseKey *)[self getKeyCopy] autorelease];
SwordVerseKey *key = [SwordVerseKey verseKeyWithVersification:[self versification]];
[key setHeadings:YES];
[key setPosition:0];
- [self setKey:key];
+ [self setSwordKey:key];
ret = [self renderedText];
// restore old key
- [self setKey:save];
+ [self setSwordKey:save];
return ret;
}
- (NSString *)bookIntroductionFor:(SwordBibleBook *)aBook {
- NSString *ret = @"";
+ NSString *ret;
// save key
- SwordVerseKey *save = [self getKeyCopy];
+ SwordVerseKey *save = [(SwordVerseKey *)[self getKeyCopy] autorelease];
SwordVerseKey *key = [SwordVerseKey verseKeyWithVersification:[self versification]];
[key setHeadings:YES];
@@ -309,20 +307,20 @@
[key setBook:[aBook numberInTestament]];
[key setChapter:0];
[key setVerse:0];
- [self setKey:key];
+ [self setSwordKey:key];
ret = [self renderedText];
// restore old key
- [self setKey:save];
+ [self setSwordKey:save];
return ret;
}
- (NSString *)chapterIntroductionFor:(SwordBibleBook *)aBook chapter:(int)chapter {
- NSString *ret = @"";
+ NSString *ret;
// save key
- SwordVerseKey *save = [self getKeyCopy];
+ SwordVerseKey *save = [(SwordVerseKey *)[self getKeyCopy] autorelease];
SwordVerseKey *key = [SwordVerseKey verseKeyWithVersification:[self versification]];
[key setHeadings:YES];
@@ -331,23 +329,23 @@
[key setBook:[aBook numberInTestament]];
[key setChapter:chapter];
[key setVerse:0];
- [self setKey:key];
+ [self setSwordKey:key];
ret = [self renderedText];
// restore old key
- [self setKey:save];
+ [self setSwordKey:save];
return ret;
}
-- (SwordBibleTextEntry *)textEntryForKey:(SwordVerseKey *)aKey textType:(TextPullType)aType {
+- (SwordModuleTextEntry *)textEntryForKey:(SwordKey *)aKey textType:(TextPullType)aType {
SwordBibleTextEntry *ret = nil;
if(aKey) {
[moduleLock lock];
- [self setKey:aKey];
+ [self setSwordKey:aKey];
if(![self error]) {
- NSString *txt = @"";
+ NSString *txt;
if(aType == TextTypeRendered) {
txt = [self renderedText];
} else {
@@ -363,7 +361,7 @@
if([swManager globalOption:SW_OPTION_HEADINGS] && [self hasFeature:SWMOD_FEATURE_HEADINGS]) {
NSString *preverseHeading = [self entryAttributeValuePreverse];
if(preverseHeading && [preverseHeading length] > 0) {
- [ret setPreverseHeading:preverseHeading];
+ [ret setPreVerseHeading:preverseHeading];
}
}
}
@@ -393,7 +391,7 @@
#pragma mark - SwordModuleAccess
-- (id)createKey {
+- (SwordKey *)createKey {
sword::VerseKey *vk = (sword::VerseKey *)swModule->CreateKey();
SwordVerseKey *newKey = [SwordVerseKey verseKeyWithSWVerseKey:vk makeCopy:YES];
delete vk;
@@ -401,19 +399,19 @@
return newKey;
}
-- (id)getKey {
+- (SwordKey *)getKey {
return [SwordVerseKey verseKeyWithSWVerseKey:(sword::VerseKey *)swModule->getKey()];
}
-- (id)getKeyCopy {
+- (SwordKey *)getKeyCopy {
return [SwordVerseKey verseKeyWithSWVerseKey:(sword::VerseKey *)swModule->getKey() makeCopy:YES];
}
- (long)entryCount {
swModule->setPosition(sword::TOP);
- unsigned long verseLowIndex = swModule->Index();
+ long verseLowIndex = swModule->Index();
swModule->setPosition(sword::BOTTOM);
- unsigned long verseHighIndex = swModule->Index();
+ long verseHighIndex = swModule->Index();
return verseHighIndex - verseLowIndex;
}
@@ -453,14 +451,14 @@
long highVerse = lowVerse + (context * 2);
for(;lowVerse <= highVerse;lowVerse++) {
[vk setVerse:lowVerse];
- SwordBibleTextEntry *entry = [self textEntryForKey:vk textType:textType];
+ SwordBibleTextEntry *entry = (SwordBibleTextEntry *) [self textEntryForKey:vk textType:textType];
if(entry) {
[ret addObject:entry];
}
[vk increment];
}
} else {
- SwordBibleTextEntry *entry = [self textEntryForKey:vk textType:textType];
+ SwordBibleTextEntry *entry = (SwordBibleTextEntry *) [self textEntryForKey:vk textType:textType];
if(entry) {
[ret addObject:entry];
}
Modified: trunk/bindings/objc/src/SwordBibleBook.h
===================================================================
--- trunk/bindings/objc/src/SwordBibleBook.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBibleBook.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -22,14 +22,14 @@
NSString *localizedName;
int number;
- int numberInTestament;
- int testament;
+ char numberInTestament;
+ char testament;
NSArray *chapters;
}
@property (readwrite) int number;
- at property (readwrite) int numberInTestament;
- at property (readwrite) int testament;
+ at property (readwrite) char numberInTestament;
+ at property (readwrite) char testament;
@property (retain, readwrite) NSString *localizedName;
@property (retain, readwrite) NSArray *chapters;
@@ -43,7 +43,7 @@
- (int)numberOfChapters;
- (int)numberOfVersesForChapter:(int)chapter;
/**
- get book index for versekey
+ get book index for verseKey
that is: book number + testament * 100
*/
- (int)generatedIndex;
Modified: trunk/bindings/objc/src/SwordBibleBook.mm
===================================================================
--- trunk/bindings/objc/src/SwordBibleBook.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBibleBook.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -40,7 +40,7 @@
[self setTestament:vk.Testament()];
[self setNumberInTestament:vk.Book()];
- // get system localemgr to be able to translate the english bookname
+ // get system localeMgr to be able to translate the english bookName
sword::LocaleMgr *lmgr = sword::LocaleMgr::getSystemLocaleMgr();
self.localizedName = [NSString stringWithUTF8String:lmgr->translate(swBook->getLongName())];
}
@@ -85,7 +85,7 @@
if(chapters == nil) {
NSMutableArray *temp = [NSMutableArray array];
for(int i = 0;i < swBook->getChapterMax();i++) {
- [temp addObject:[[SwordBibleChapter alloc] initWithBook:self andChapter:i+1]];
+ [temp addObject:[[[SwordBibleChapter alloc] initWithBook:self andChapter:i+1] autorelease]];
}
[self setChapters:[NSArray arrayWithArray:temp]];
}
@@ -93,7 +93,7 @@
}
/**
- get book index for versekey
+ get book index for verseKey
that is: book number + testament * 100
*/
- (int)generatedIndex {
Modified: trunk/bindings/objc/src/SwordBibleTextEntry.h
===================================================================
--- trunk/bindings/objc/src/SwordBibleTextEntry.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBibleTextEntry.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -10,10 +10,10 @@
#import "SwordModuleTextEntry.h"
@interface SwordBibleTextEntry : SwordModuleTextEntry {
- NSString *preverseHeading;
+ NSString *preVerseHeading;
}
- at property (readwrite, retain) NSString *preverseHeading;
+ at property (readwrite, retain) NSString *preVerseHeading;
+ (id)textEntryForKey:(NSString *)aKey andText:(NSString *)aText;
- (id)initWithKey:(NSString *)aKey andText:(NSString *)aText;
Modified: trunk/bindings/objc/src/SwordBibleTextEntry.m
===================================================================
--- trunk/bindings/objc/src/SwordBibleTextEntry.m 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBibleTextEntry.m 2012-07-23 20:49:06 UTC (rev 2711)
@@ -10,7 +10,7 @@
@implementation SwordBibleTextEntry
- at synthesize preverseHeading;
+ at synthesize preVerseHeading;
+ (id)textEntryForKey:(NSString *)aKey andText:(NSString *)aText {
return [[[SwordBibleTextEntry alloc] initWithKey:aKey andText:aText] autorelease];
@@ -30,7 +30,7 @@
}
- (void)dealloc {
- [self setPreverseHeading:nil];
+ [self setPreVerseHeading:nil];
[super dealloc];
}
Modified: trunk/bindings/objc/src/SwordBook.h
===================================================================
--- trunk/bindings/objc/src/SwordBook.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBook.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -29,9 +29,9 @@
@property(readwrite, retain) NSMutableDictionary *contents;
/**
- return the tree content for the given treekey
- the treekey has to be already loaded
- @param[in]: treekey that we should look for, nil for root
+ return the tree content for the given treeKey
+ the treeKey has to be already loaded
+ @param[in]: treeKey that we should look for, nil for root
@return: SwordTreeEntry
*/
- (SwordModuleTreeEntry *)treeEntryForKey:(NSString *)treeKey;
Modified: trunk/bindings/objc/src/SwordBook.mm
===================================================================
--- trunk/bindings/objc/src/SwordBook.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordBook.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -12,7 +12,6 @@
*/
#import "SwordBook.h"
-#import "SwordModule.h"
#import "SwordModuleTreeEntry.h"
@interface SwordBook ()
@@ -54,14 +53,14 @@
}
- (SwordModuleTreeEntry *)treeEntryForKey:(NSString *)treeKey {
- SwordModuleTreeEntry * ret = nil;
+ SwordModuleTreeEntry * ret;
[moduleLock lock];
if(treeKey == nil) {
ret = [contents objectForKey:@"root"];
if(ret == nil) {
- sword::TreeKeyIdx *treeKey = dynamic_cast<sword::TreeKeyIdx*>((sword::SWKey *)*(swModule));
- ret = [self _treeEntryForKey:treeKey];
+ sword::TreeKeyIdx *tk = dynamic_cast<sword::TreeKeyIdx*>((sword::SWKey *)*(swModule));
+ ret = [self _treeEntryForKey:tk];
// add to content
[contents setObject:ret forKey:@"root"];
}
@@ -87,22 +86,22 @@
}
- (SwordModuleTreeEntry *)_treeEntryForKey:(sword::TreeKeyIdx *)treeKey {
- SwordModuleTreeEntry *ret = [[SwordModuleTreeEntry alloc] init];
+ SwordModuleTreeEntry *ret = [[[SwordModuleTreeEntry alloc] init] autorelease];
char *treeNodeName = (char *)treeKey->getText();
- NSString *nname = @"";
+ NSString *nName;
if(strlen(treeNodeName) == 0) {
- nname = @"root";
+ nName = @"root";
} else {
// key encoding depends on module encoding
- nname = [NSString stringWithUTF8String:treeNodeName];
- if(!nname) {
- nname = [NSString stringWithCString:treeNodeName encoding:NSISOLatin1StringEncoding];
+ nName = [NSString stringWithUTF8String:treeNodeName];
+ if(!nName) {
+ nName = [NSString stringWithCString:treeNodeName encoding:NSISOLatin1StringEncoding];
}
}
// set name
- [ret setKey:nname];
+ [ret setKey:nName];
NSMutableArray *c = [NSMutableArray array];
[ret setContent:c];
@@ -111,15 +110,15 @@
// get first child
treeKey->firstChild();
do {
- NSString *subname = @"";
+ NSString *subName;
// key encoding depends on module encoding
const char *textStr = treeKey->getText();
- subname = [NSString stringWithUTF8String:textStr];
- if(!subname) {
- subname = [NSString stringWithCString:textStr encoding:NSISOLatin1StringEncoding];
+ subName = [NSString stringWithUTF8String:textStr];
+ if(!subName) {
+ subName = [NSString stringWithCString:textStr encoding:NSISOLatin1StringEncoding];
}
- if(subname) {
- [c addObject:subname];
+ if(subName) {
+ [c addObject:subName];
}
}
while(treeKey->nextSibling());
@@ -131,8 +130,8 @@
- (void)testLoop {
SwordModuleTreeEntry *entry = [self treeEntryForKey:nil];
if([[entry content] count] > 0) {
- for(NSString *subkey in [entry content]) {
- entry = [self treeEntryForKey:subkey];
+ for(NSString *subKey in [entry content]) {
+ entry = [self treeEntryForKey:subKey];
if([[entry content] count] > 0) {
} else {
DLog(@"Entry: %@", [entry key]);
Modified: trunk/bindings/objc/src/SwordDictionary.mm
===================================================================
--- trunk/bindings/objc/src/SwordDictionary.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordDictionary.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -12,7 +12,6 @@
*/
#import "SwordDictionary.h"
-#import "SwordModuleTextEntry.h"
#import "Configuration.h"
@interface SwordDictionary (/* Private, class continuation */)
@@ -78,7 +77,7 @@
- (void)readFromCache {
//open cached file
NSString *cachePath = [[[Configuration config] defaultAppSupportPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"cache-%@", [self name]]];
- NSMutableArray *data = [NSArray arrayWithContentsOfFile:cachePath];
+ NSMutableArray *data = [NSMutableArray arrayWithContentsOfFile:cachePath];
if(data != nil) {
self.keys = data;
} else {
Modified: trunk/bindings/objc/src/SwordInstallSource.mm
===================================================================
--- trunk/bindings/objc/src/SwordInstallSource.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordInstallSource.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -62,7 +62,7 @@
- (void)finalize {
if(temporarySource == NO) {
- //LogL(LOG_DEBUG, @"[SwordInstallSource -finalize] deleting swInstalSource");
+ //LogL(LOG_DEBUG, @"[SwordInstallSource -finalize] deleting swInstallSource");
//delete swInstallSource;
}
@@ -70,6 +70,7 @@
}
- (void)dealloc {
+ [swordManager release];
[super dealloc];
}
@@ -160,12 +161,8 @@
/** list module types */
- (NSArray *)listModuleTypes {
- NSArray *ret = nil;
-
- DLog(@"");
- ret = [SwordManager moduleTypes];
-
- return ret;
+ NSArray *ret = [SwordManager moduleTypes];
+ return ret;
}
// get associated SwordManager
@@ -176,7 +173,7 @@
sword::SWMgr *mgr;
if([[self source] isEqualToString:@"localhost"]) {
// create SwordManager from new SWMgr of path
- mgr = (sword::SWMgr *)new sword::SWMgr([[self directory] UTF8String], true, NULL, false, false);
+ mgr = new sword::SWMgr([[self directory] UTF8String], true, NULL, false, false);
} else {
// create SwordManager from the SWMgr of this source
mgr = swInstallSource->getMgr();
Modified: trunk/bindings/objc/src/SwordInstallSourceManager.h
===================================================================
--- trunk/bindings/objc/src/SwordInstallSourceManager.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordInstallSourceManager.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -70,7 +70,7 @@
/** re-init after adding or removing new modules */
- (void)reinitialize;
-// installation/uninstallation
+// installation/unInstallation
- (int)installModule:(SwordModule *)aModule fromSource:(SwordInstallSource *)is withManager:(SwordManager *)manager;
- (int)uninstallModule:(SwordModule *)aModule fromManager:(SwordManager *)swManager;
Modified: trunk/bindings/objc/src/SwordInstallSourceManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordInstallSourceManager.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordInstallSourceManager.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -235,7 +235,7 @@
[self addInstallSource:is];
}
-// installation/uninstallation
+// installation/unInstallation
- (int)installModule:(SwordModule *)aModule fromSource:(SwordInstallSource *)is withManager:(SwordManager *)manager {
int stat;
Modified: trunk/bindings/objc/src/SwordKey.h
===================================================================
--- trunk/bindings/objc/src/SwordKey.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordKey.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -19,20 +19,20 @@
BOOL created;
}
-+ (id)swordKey;
-+ (id)swordKeyWithRef:(NSString *)aRef;
++ (SwordKey *)swordKey;
++ (SwordKey *)swordKeyWithRef:(NSString *)aRef;
#ifdef __cplusplus
-+ (id)swordKeyWithSWKey:(sword::SWKey *)aSk;
-+ (id)swordKeyWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy;
-- (id)initWithSWKey:(sword::SWKey *)aSk;
-- (id)initWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy;
++ (SwordKey *)swordKeyWithSWKey:(sword::SWKey *)aSk;
++ (SwordKey *)swordKeyWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy;
+- (SwordKey *)initWithSWKey:(sword::SWKey *)aSk;
+- (SwordKey *)initWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy;
- (sword::SWKey *)swKey;
#endif
-- (id)initWithRef:(NSString *)aRef;
+- (SwordKey *)initWithRef:(NSString *)aRef;
-- (id)clone;
+- (SwordKey *)clone;
- (void)setPersist:(BOOL)flag;
- (BOOL)persist;
Modified: trunk/bindings/objc/src/SwordKey.mm
===================================================================
--- trunk/bindings/objc/src/SwordKey.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordKey.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -11,19 +11,19 @@
@implementation SwordKey
-+ (id)swordKey {
++ (SwordKey *)swordKey {
return [[[SwordKey alloc] init] autorelease];
}
-+ (id)swordKeyWithRef:(NSString *)aRef {
++ (SwordKey *)swordKeyWithRef:(NSString *)aRef {
return [[[SwordKey alloc] initWithRef:aRef] autorelease];
}
-+ (id)swordKeyWithSWKey:(sword::SWKey *)aSk {
++ (SwordKey *)swordKeyWithSWKey:(sword::SWKey *)aSk {
return [[[SwordKey alloc] initWithSWKey:aSk] autorelease];
}
-+ (id)swordKeyWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy {
++ (SwordKey *)swordKeyWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy {
return [[[SwordKey alloc] initWithSWKey:aSk makeCopy:copy] autorelease];
}
@@ -31,11 +31,11 @@
return [self initWithRef:nil];
}
-- (id)initWithSWKey:(sword::SWKey *)aSk {
+- (SwordKey *)initWithSWKey:(sword::SWKey *)aSk {
return [self initWithSWKey:aSk makeCopy:NO];
}
-- (id)initWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy {
+- (SwordKey *)initWithSWKey:(sword::SWKey *)aSk makeCopy:(BOOL)copy {
self = [super init];
if(self) {
if(copy) {
@@ -53,7 +53,7 @@
return self;
}
-- (id)initWithRef:(NSString *)aRef {
+- (SwordKey *)initWithRef:(NSString *)aRef {
self = [super init];
if(self) {
sk = new sword::SWKey([aRef UTF8String]);
@@ -79,7 +79,7 @@
[super dealloc];
}
-- (id)clone {
+- (SwordKey *)clone {
return [SwordKey swordKeyWithSWKey:sk];
}
Modified: trunk/bindings/objc/src/SwordListKey.h
===================================================================
--- trunk/bindings/objc/src/SwordListKey.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordListKey.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -15,31 +15,32 @@
#endif
@class SwordBible, VerseEnumerator;
+ at class SwordVerseKey;
@interface SwordListKey : SwordKey {
}
-+ (id)listKeyWithRef:(NSString *)aRef;
-+ (id)listKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme;
-+ (id)listKeyWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme;
++ (SwordListKey *)listKeyWithRef:(NSString *)aRef;
++ (SwordListKey *)listKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme;
++ (SwordListKey *)listKeyWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme;
#ifdef __cplusplus
-+ (id)listKeyWithSWListKey:(sword::ListKey *)aLk;
-+ (id)listKeyWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy;
-- (id)initWithSWListKey:(sword::ListKey *)aLk;
-- (id)initWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy;
++ (SwordListKey *)listKeyWithSWListKey:(sword::ListKey *)aLk;
++ (SwordListKey *)listKeyWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy;
+- (SwordListKey *)initWithSWListKey:(sword::ListKey *)aLk;
+- (SwordListKey *)initWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy;
- (sword::ListKey *)swListKey;
#endif
-- (id)initWithRef:(NSString *)aRef;
-- (id)initWithRef:(NSString *)aRef v11n:(NSString *)scheme;
-- (id)initWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme;
+- (SwordListKey *)initWithRef:(NSString *)aRef;
+- (SwordListKey *)initWithRef:(NSString *)aRef v11n:(NSString *)scheme;
+- (SwordListKey *)initWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme;
- (void)parse;
- (void)parseWithHeaders;
- (VerseEnumerator *)verseEnumerator;
- (NSInteger)numberOfVerses;
-- (BOOL)containsKey:(SwordKey *)aVerseKey;
+- (BOOL)containsKey:(SwordVerseKey *)aVerseKey;
@end
Modified: trunk/bindings/objc/src/SwordListKey.mm
===================================================================
--- trunk/bindings/objc/src/SwordListKey.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordListKey.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -6,33 +6,27 @@
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
-#import "SwordListKey.h"
-#import "SwordBible.h"
-#import "SwordVerseKey.h"
-#import "VerseEnumerator.h"
+#import <ObjCSword/ObjCSword.h>
- at interface SwordListKey ()
- at end
-
@implementation SwordListKey
-+ (id)listKeyWithRef:(NSString *)aRef {
++ (SwordListKey *)listKeyWithRef:(NSString *)aRef {
return [[[SwordListKey alloc] initWithRef:aRef] autorelease];
}
-+ (id)listKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme {
++ (SwordListKey *)listKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme {
return [[[SwordListKey alloc] initWithRef:aRef v11n:scheme] autorelease];
}
-+ (id)listKeyWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme {
++ (SwordListKey *)listKeyWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme {
return [[[SwordListKey alloc] initWithRef:aRef headings:headings v11n:scheme] autorelease];
}
-+ (id)listKeyWithSWListKey:(sword::ListKey *)aLk {
++ (SwordListKey *)listKeyWithSWListKey:(sword::ListKey *)aLk {
return [[[SwordListKey alloc] initWithSWListKey:aLk] autorelease];
}
-+ (id)listKeyWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy {
++ (SwordListKey *)listKeyWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy {
return [[[SwordListKey alloc] initWithSWListKey:aLk makeCopy:copy] autorelease];
}
@@ -40,23 +34,23 @@
return [super init];
}
-- (id)initWithSWListKey:(sword::ListKey *)aLk {
- return [super initWithSWKey:aLk];
+- (SwordListKey *)initWithSWListKey:(sword::ListKey *)aLk {
+ return (SwordListKey *) [super initWithSWKey:aLk];
}
-- (id)initWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy {
- return [super initWithSWKey:aLk makeCopy:copy];
+- (SwordListKey *)initWithSWListKey:(sword::ListKey *)aLk makeCopy:(BOOL)copy {
+ return (SwordListKey *) [super initWithSWKey:aLk makeCopy:copy];
}
-- (id)initWithRef:(NSString *)aRef {
+- (SwordListKey *)initWithRef:(NSString *)aRef {
return [self initWithRef:aRef v11n:nil];
}
-- (id)initWithRef:(NSString *)aRef v11n:(NSString *)scheme {
+- (SwordListKey *)initWithRef:(NSString *)aRef v11n:(NSString *)scheme {
return [self initWithRef:aRef headings:NO v11n:scheme];
}
-- (id)initWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme {
+- (SwordListKey *)initWithRef:(NSString *)aRef headings:(BOOL)headings v11n:(NSString *)scheme {
sword::VerseKey vk;
vk.Headings((char)headings);
if(scheme) {
@@ -64,7 +58,7 @@
}
sword::ListKey listKey = vk.ParseVerseList([aRef UTF8String], "gen", true);
sword::ListKey *lk = new sword::ListKey(listKey);
- return [super initWithSWKey:lk];
+ return (SwordListKey *) [super initWithSWKey:lk];
}
- (void)finalize {
@@ -90,7 +84,6 @@
}
- (void)parseWithHeaders {
-
}
- (VerseEnumerator *)verseEnumerator {
@@ -99,12 +92,10 @@
- (BOOL)containsKey:(SwordVerseKey *)aVerseKey {
BOOL ret = NO;
-
if(sk) {
*sk = [[aVerseKey osisRef] UTF8String];
ret = !sk->Error();
}
-
return ret;
}
Modified: trunk/bindings/objc/src/SwordLocaleManager.h
===================================================================
--- trunk/bindings/objc/src/SwordLocaleManager.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordLocaleManager.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -15,7 +15,7 @@
/**
Initializes the global locale system.
- Any created instance that needs localozed information will use it.
+ Any created instance that needs localized information will use it.
*/
- (void)initLocale;
Modified: trunk/bindings/objc/src/SwordLocaleManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordLocaleManager.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordLocaleManager.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -14,7 +14,7 @@
@implementation SwordLocaleManager
+ (SwordLocaleManager *)defaultManager {
- static SwordLocaleManager *instance;
+ static SwordLocaleManager *instance = nil;
if(instance == nil) {
// use default path
instance = [[SwordLocaleManager alloc] init];
@@ -38,16 +38,16 @@
NSArray *availLocales = [NSLocale preferredLanguages];
NSString *lang = nil;
- NSString *loc = nil;
+ NSString *loc;
BOOL haveLocale = NO;
// for every language, check if we know the locales
- sword::StringList localelist = lManager->getAvailableLocales();
+ sword::StringList localeList = lManager->getAvailableLocales();
NSEnumerator *iter = [availLocales objectEnumerator];
while((loc = [iter nextObject]) && !haveLocale) {
// check if this locale is available in SWORD
sword::StringList::iterator it;
sword::SWBuf locale;
- for(it = localelist.begin(); it != localelist.end(); ++it) {
+ for(it = localeList.begin(); it != localeList.end(); ++it) {
locale = *it;
NSString *swLoc = [NSString stringWithCString:locale.c_str() encoding:NSUTF8StringEncoding];
if([swLoc hasPrefix:loc]) {
Modified: trunk/bindings/objc/src/SwordManager.h
===================================================================
--- trunk/bindings/objc/src/SwordManager.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordManager.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -165,7 +165,7 @@
- (id)initWithPath:(NSString *)path;
/**
- Add an additional path to the manager to aument more modules.
+ Add an additional path to the manager to augment more modules.
*/
- (void)addPath:(NSString*)path;
@@ -226,7 +226,7 @@
- (NSArray *)modulesForCategory:(ModuleCategory)cat;
#ifdef __cplusplus
-- (id)initWithSWMgr:(sword::SWMgr *)smgr;
+- (id)initWithSWMgr:(sword::SWMgr *)swMgr;
- (sword::SWModule *)getSWModuleWithName:(NSString *)moduleName;
/**
Modified: trunk/bindings/objc/src/SwordManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordManager.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordManager.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -11,23 +11,15 @@
General Public License for more details. (http://www.gnu.org/licenses/gpl.html)
*/
+#import "ObjCSword_Prefix.pch"
#import "SwordManager.h"
#import "Configuration.h"
#include <string>
-#include <list>
#include "gbfplain.h"
#include "thmlplain.h"
#include "osisplain.h"
#import "Notifications.h"
-#import "SwordBook.h"
-#import "SwordModule.h"
-#import "SwordBible.h"
-#import "SwordCommentary.h"
-#import "SwordDictionary.h"
-#import "SwordListKey.h"
-#import "SwordVerseKey.h"
-#import "ObjCSword_Prefix.pch"
using std::string;
using std::list;
@@ -190,7 +182,7 @@
}
+ (SwordManager *)defaultManager {
- static SwordManager *instance;
+ static SwordManager *instance = nil;
if(instance == nil) {
// use default path
instance = [[SwordManager alloc] initWithPath:[[Configuration config] defaultModulePath]];
@@ -208,7 +200,7 @@
self.modulesPath = path;
self.modules = [NSDictionary dictionary];
- self.managerLock = (NSLock *)[[NSRecursiveLock alloc] init];
+ self.managerLock = [(NSLock *)[[NSRecursiveLock alloc] init] autorelease];
[self reInit];
@@ -230,7 +222,7 @@
temporaryManager = YES;
self.modules = [NSDictionary dictionary];
- self.managerLock = (NSLock *)[[NSRecursiveLock alloc] init];
+ self.managerLock = [(NSLock *)[[NSRecursiveLock alloc] init] autorelease];
[self refreshModules];
}
@@ -271,8 +263,8 @@
NSArray *subDirs = [fm contentsOfDirectoryAtPath:modulesPath error:NULL];
// for all sub directories add module
BOOL directory;
- NSString *fullSubDir = nil;
- NSString *subDir = nil;
+ NSString *fullSubDir;
+ NSString *subDir;
for(subDir in subDirs) {
// as long as it's not hidden
if(![subDir hasPrefix:@"."] &&
@@ -381,7 +373,7 @@
}
// sort
- NSArray *sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]];
+ NSArray *sortDescriptors = [NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES] autorelease]];
[ret sortUsingDescriptors:sortDescriptors];
return [NSArray arrayWithArray:ret];
@@ -396,8 +388,8 @@
}
// sort
- NSArray *sortDescritors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]];
- [ret sortUsingDescriptors:sortDescritors];
+ NSArray *sortDescriptors = [NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES] autorelease]];
+ [ret sortUsingDescriptors:sortDescriptors];
return [NSArray arrayWithArray:ret];
}
@@ -411,20 +403,20 @@
}
// sort
- NSArray *sortDescritors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]];
- [ret sortUsingDescriptors:sortDescritors];
+ NSArray *sortDescriptors = [NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES] autorelease]];
+ [ret sortUsingDescriptors:sortDescriptors];
return [NSArray arrayWithArray:ret];
}
-#pragma mark - lowlevel methods
+#pragma mark - lowLevel methods
- (sword::SWMgr *)swManager {
return swManager;
}
- (sword::SWModule *)getSWModuleWithName:(NSString *)moduleName {
- sword::SWModule *module = NULL;
+ sword::SWModule *module;
[managerLock lock];
module = swManager->Modules[[moduleName UTF8String]];
Modified: trunk/bindings/objc/src/SwordModule.h
===================================================================
--- trunk/bindings/objc/src/SwordModule.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordModule.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -252,20 +252,20 @@
/**
Set position from a key
*/
-- (void)setKey:(SwordKey *)aKey;
+- (void)setSwordKey:(SwordKey *)aKey;
/**
Module key. New instance created by module.
*/
-- (id)createKey;
+- (SwordKey *)createKey;
/**
Module key. Reference only.
*/
-- (id)getKey;
+- (SwordKey *)getKey;
/**
Module key. Reference only but cloned.
*/
-- (id)getKeyCopy;
+- (SwordKey *)getKeyCopy;
// ------------------- module metadata processing ------------------
Modified: trunk/bindings/objc/src/SwordModule.mm
===================================================================
--- trunk/bindings/objc/src/SwordModule.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordModule.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -11,6 +11,7 @@
General Public License for more details. (http://www.gnu.org/licenses/gpl.html)
*/
+#import "ObjCSword_Prefix.pch"
#import "SwordModule.h"
#import "SwordManager.h"
#import "SwordModuleTextEntry.h"
@@ -20,12 +21,6 @@
#import "SwordDictionary.h"
#import "SwordBook.h"
-#import "rtfhtml.h"
-#import "swtext.h"
-#import "versekey.h"
-#import "regex.h"
-#import "ObjCSword_Prefix.pch"
-
@interface SwordModule ()
@property (retain, readwrite) NSString *name;
@@ -494,11 +489,11 @@
swModule->setKey([aKeyString UTF8String]);
}
-- (void)setKey:(SwordKey *)aKey {
+- (void)setSwordKey:(SwordKey *)aKey {
swModule->setKey([aKey swKey]);
}
-- (id)createKey {
+- (SwordKey *)createKey {
sword::SWKey *sk = swModule->CreateKey();
SwordKey *newKey = [SwordKey swordKeyWithSWKey:sk makeCopy:YES];
delete sk;
@@ -506,11 +501,11 @@
return newKey;
}
-- (id)getKey {
+- (SwordKey *)getKey {
return [SwordKey swordKeyWithSWKey:swModule->getKey()];
}
-- (id)getKeyCopy {
+- (SwordKey *)getKeyCopy {
return [SwordKey swordKeyWithSWKey:swModule->getKey() makeCopy:YES];
}
@@ -562,8 +557,7 @@
}
- (NSString *)entryAttributeValuePreverse {
- NSString *ret = @"";
- ret = [NSString stringWithUTF8String:swModule->getEntryAttributes()["Heading"]["Preverse"]["0"].c_str()];
+ NSString *ret = [NSString stringWithUTF8String:swModule->getEntryAttributes()["Heading"]["Preverse"]["0"].c_str()];
return ret;
}
@@ -595,7 +589,7 @@
if (word->second.find("Text") == word->second.end())
continue; // no text? let's skip
}
- NSMutableString *stringValStr = [NSMutableString stringWithUTF8String:strongVal->second];
+ NSMutableString *stringValStr = [NSMutableString stringWithUTF8String:(const char *)strongVal->second];
if(stringValStr) {
[stringValStr replaceOccurrencesOfString:@"|x-Strongs:" withString:@" " options:0 range:NSMakeRange(0, [stringValStr length])];
[array addObject:stringValStr];
@@ -608,7 +602,7 @@
- (NSString *)entryAttributeValuePreverseForKey:(SwordKey *)aKey {
[moduleLock lock];
- [self setKey:aKey];
+ [self setSwordKey:aKey];
swModule->RenderText(); // force processing of key
NSString *value = [self entryAttributeValuePreverse];
[moduleLock unlock];
@@ -617,7 +611,7 @@
- (NSString *)entryAttributeValueFootnoteOfType:(NSString *)fnType indexValue:(NSString *)index forKey:(SwordKey *)aKey {
[moduleLock lock];
- [self setKey:aKey];
+ [self setSwordKey:aKey];
swModule->RenderText(); // force processing of key
NSString *value = [self entryAttributeValueFootnoteOfType:fnType indexValue:index];
[moduleLock unlock];
@@ -680,7 +674,7 @@
if(aKey) {
[moduleLock lock];
- [self setKey:aKey];
+ [self setSwordKey:aKey];
if(![self error]) {
NSString *txt = @"";
if(aType == TextTypeRendered) {
Modified: trunk/bindings/objc/src/SwordVerseKey.h
===================================================================
--- trunk/bindings/objc/src/SwordVerseKey.h 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordVerseKey.h 2012-07-23 20:49:06 UTC (rev 2711)
@@ -16,28 +16,28 @@
@interface SwordVerseKey : SwordKey {
}
-+ (id)verseKey;
-+ (id)verseKeyWithVersification:(NSString *)scheme;
-+ (id)verseKeyWithRef:(NSString *)aRef;
-+ (id)verseKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme;
++ (SwordVerseKey *)verseKey;
++ (SwordVerseKey *)verseKeyWithVersification:(NSString *)scheme;
++ (SwordVerseKey *)verseKeyWithRef:(NSString *)aRef;
++ (SwordVerseKey *)verseKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme;
#ifdef __cplusplus
-+ (id)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk;
-+ (id)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy;
-- (id)initWithSWVerseKey:(sword::VerseKey *)aVk;
-- (id)initWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy;
++ (SwordVerseKey *)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk;
++ (SwordVerseKey *)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy;
+- (SwordVerseKey *)initWithSWVerseKey:(sword::VerseKey *)aVk;
+- (SwordVerseKey *)initWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy;
- (sword::VerseKey *)swVerseKey;
#endif
-- (id)initWithVersification:(NSString *)scheme;
-- (id)initWithRef:(NSString *)aRef;
-- (id)initWithRef:(NSString *)aRef v11n:(NSString *)scheme;
+- (SwordVerseKey *)initWithVersification:(NSString *)scheme;
+- (SwordVerseKey *)initWithRef:(NSString *)aRef;
+- (SwordVerseKey *)initWithRef:(NSString *)aRef v11n:(NSString *)scheme;
- (int)index;
- (int)testament;
-- (void)setTestament:(int)val;
+- (void)setTestament:(char)val;
- (int)book;
-- (void)setBook:(int)val;
+- (void)setBook:(char)val;
- (int)chapter;
- (void)setChapter:(int)val;
- (int)verse;
Modified: trunk/bindings/objc/src/SwordVerseKey.mm
===================================================================
--- trunk/bindings/objc/src/SwordVerseKey.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordVerseKey.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -11,27 +11,27 @@
@implementation SwordVerseKey
-+ (id)verseKey {
++ (SwordVerseKey *)verseKey {
return [[[SwordVerseKey alloc] init] autorelease];
}
-+ (id)verseKeyWithVersification:(NSString *)scheme {
++ (SwordVerseKey *)verseKeyWithVersification:(NSString *)scheme {
return [[[SwordVerseKey alloc] initWithVersification:scheme] autorelease];
}
-+ (id)verseKeyWithRef:(NSString *)aRef {
++ (SwordVerseKey *)verseKeyWithRef:(NSString *)aRef {
return [[[SwordVerseKey alloc] initWithRef:aRef] autorelease];
}
-+ (id)verseKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme {
++ (SwordVerseKey *)verseKeyWithRef:(NSString *)aRef v11n:(NSString *)scheme {
return [[[SwordVerseKey alloc] initWithRef:aRef v11n:scheme] autorelease];
}
-+ (id)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk {
++ (SwordVerseKey *)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk {
return [[[SwordVerseKey alloc] initWithSWVerseKey:aVk] autorelease];
}
-+ (id)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy {
++ (SwordVerseKey *)verseKeyWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy {
return [[[SwordVerseKey alloc] initWithSWVerseKey:aVk makeCopy:copy] autorelease];
}
@@ -39,15 +39,15 @@
return [self initWithRef:nil];
}
-- (id)initWithVersification:(NSString *)scheme {
+- (SwordVerseKey *)initWithVersification:(NSString *)scheme {
return [self initWithRef:nil v11n:scheme];
}
-- (id)initWithSWVerseKey:(sword::VerseKey *)aVk {
+- (SwordVerseKey *)initWithSWVerseKey:(sword::VerseKey *)aVk {
return [self initWithSWVerseKey:aVk makeCopy:NO];
}
-- (id)initWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy {
+- (SwordVerseKey *)initWithSWVerseKey:(sword::VerseKey *)aVk makeCopy:(BOOL)copy {
self = [super initWithSWKey:aVk makeCopy:copy];
if(self) {
[self swVerseKey]->setVersificationSystem(aVk->getVersificationSystem());
@@ -55,11 +55,11 @@
return self;
}
-- (id)initWithRef:(NSString *)aRef {
+- (SwordVerseKey *)initWithRef:(NSString *)aRef {
return [self initWithRef:aRef v11n:nil];
}
-- (id)initWithRef:(NSString *)aRef v11n:(NSString *)scheme {
+- (SwordVerseKey *)initWithRef:(NSString *)aRef v11n:(NSString *)scheme {
sword::VerseKey *vk = new sword::VerseKey();
self = [super initWithSWKey:vk];
if(self) {
@@ -84,7 +84,7 @@
[super dealloc];
}
-- (id)clone {
+- (SwordKey *)clone {
return [SwordVerseKey verseKeyWithSWVerseKey:(sword::VerseKey *)sk];
}
@@ -97,7 +97,7 @@
}
- (void)setHeadings:(BOOL)flag {
- ((sword::VerseKey *)sk)->Headings((int)flag);
+ ((sword::VerseKey *)sk)->Headings(flag);
}
- (BOOL)autoNormalize {
@@ -105,7 +105,7 @@
}
- (void)setAutoNormalize:(BOOL)flag {
- ((sword::VerseKey *)sk)->AutoNormalize((int)flag);
+ ((sword::VerseKey *)sk)->AutoNormalize(flag);
}
- (int)testament {
@@ -124,11 +124,11 @@
return ((sword::VerseKey *)sk)->getVerse();
}
-- (void)setTestament:(int)val {
+- (void)setTestament:(char)val {
((sword::VerseKey *)sk)->setTestament(val);
}
-- (void)setBook:(int)val {
+- (void)setBook:(char)val {
((sword::VerseKey *)sk)->setBook(val);
}
Modified: trunk/bindings/objc/src/SwordVerseManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordVerseManager.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/SwordVerseManager.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -21,7 +21,7 @@
@synthesize booksPerVersification;
+ (SwordVerseManager *)defaultManager {
- static SwordVerseManager *singleton;
+ static SwordVerseManager *singleton = nil;
if(!singleton) {
singleton = [[SwordVerseManager alloc] init];
}
@@ -60,12 +60,12 @@
if(ret == nil) {
// hasn't been initialized yet
const sword::VerseMgr::System *system = verseMgr->getVersificationSystem([verseScheme UTF8String]);
- int bookCount = system->getBookCount();
+ NSUInteger bookCount = (NSUInteger)system->getBookCount();
NSMutableArray *buf = [NSMutableArray arrayWithCapacity:bookCount];
for(int i = 0;i < bookCount;i++) {
sword::VerseMgr::Book *book = (sword::VerseMgr::Book *)system->getBook(i);
- SwordBibleBook *bb = [[SwordBibleBook alloc] initWithBook:book];
+ SwordBibleBook *bb = [[[SwordBibleBook alloc] initWithBook:book] autorelease];
[bb setNumber:i+1]; // VerseKey-Book() starts at index 1
// add to array
Modified: trunk/bindings/objc/src/VerseEnumerator.mm
===================================================================
--- trunk/bindings/objc/src/VerseEnumerator.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/src/VerseEnumerator.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -31,6 +31,7 @@
}
- (void)dealloc {
+ [listKey release];
[super dealloc];
}
@@ -39,7 +40,7 @@
for(*[listKey swListKey] = sword::TOP;![listKey swListKey]->Error(); *[listKey swListKey] += 1) {
[t addObject:[listKey keyText]];
}
- // possition TOP again
+ // position TOP again
*[listKey swListKey] = sword::TOP;
return [NSArray arrayWithArray:t];
Modified: trunk/bindings/objc/test/SwordModuleLongRunTest.mm
===================================================================
--- trunk/bindings/objc/test/SwordModuleLongRunTest.mm 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/test/SwordModuleLongRunTest.mm 2012-07-23 20:49:06 UTC (rev 2711)
@@ -66,7 +66,7 @@
SwordListKey *lk = [SwordListKey listKeyWithRef:@"gen 1:1-2"];
[lk setPersist:YES];
- [com setKey:lk];
+ [com setSwordKey:lk];
NSString *ref = nil;
NSString *rendered = nil;
int count = 0;
@@ -91,7 +91,7 @@
int count = 0;
while(![lk error]) {
ref = [lk keyText];
- [com setKey:lk];
+ [com setSwordKey:lk];
rendered = [com renderedText];
NSLog(@"%@:%@", ref, rendered);
[lk increment];
Modified: trunk/bindings/objc/test/SwordModuleTest.m
===================================================================
--- trunk/bindings/objc/test/SwordModuleTest.m 2012-07-20 21:54:09 UTC (rev 2710)
+++ trunk/bindings/objc/test/SwordModuleTest.m 2012-07-23 20:49:06 UTC (rev 2711)
@@ -65,7 +65,7 @@
- (void)testLoopWithModulePos {
SwordListKey *lk = [SwordListKey listKeyWithRef:@"gen" v11n:[mod versification]];
[lk setPersist:YES];
- [mod setKey:lk];
+ [mod setSwordKey:lk];
NSString *ref = nil;
NSString *rendered = nil;
while(![mod error]) {
@@ -83,7 +83,7 @@
NSString *rendered = nil;
while(![lk error]) {
ref = [lk keyText];
- [mod setKey:lk];
+ [mod setSwordKey:lk];
rendered = [mod renderedText];
//NSLog(@"%@:%@", ref, rendered);
[lk increment];
@@ -93,7 +93,7 @@
- (void)testLoopWithModulePosWithHeadings {
SwordListKey *lk = [SwordListKey listKeyWithRef:@"gen" headings:YES v11n:[mod versification]];
[lk setPersist:YES];
- [mod setKey:lk];
+ [mod setSwordKey:lk];
NSString *ref = nil;
NSString *rendered = nil;
while(![mod error]) {
@@ -106,7 +106,7 @@
- (void)testLoopWithModulePosWithDiverseReference {
SwordListKey *lk = [SwordListKey listKeyWithRef:@"gen 1:1;4:5-8" v11n:[mod versification]];
[lk setPersist:YES];
- [mod setKey:lk];
+ [mod setSwordKey:lk];
NSString *ref = nil;
NSString *rendered = nil;
while(![mod error]) {
@@ -125,7 +125,7 @@
NSString *rendered = nil;
while(![lk error]) {
ref = [lk keyText];
- [mod setKey:lk];
+ [mod setSwordKey:lk];
rendered = [mod renderedText];
NSLog(@"%@:%@", ref, rendered);
[lk increment];
@@ -138,7 +138,7 @@
[vk setPersist:YES];
SwordListKey *lk = [SwordListKey listKeyWithRef:@"gen 1:1;4:5;8:4;10:2-5" v11n:[mod versification]];
[lk setPersist:YES];
- [mod setKey:lk];
+ [mod setSwordKey:lk];
NSString *ref = nil;
NSString *rendered = nil;
while(![mod error]) {
@@ -147,7 +147,7 @@
long lowVerse = [vk verse] - context;
long highVerse = lowVerse + (context * 2);
[vk setVerse:lowVerse];
- [mod setKey:vk];
+ [mod setSwordKey:vk];
for(;lowVerse <= highVerse;lowVerse++) {
ref = [vk keyText];
rendered = [mod renderedText];
@@ -155,7 +155,7 @@
[mod incKeyPosition];
}
// set back list key
- [mod setKey:lk];
+ [mod setSwordKey:lk];
[mod incKeyPosition];
} else {
ref = [lk keyText];
More information about the sword-cvs
mailing list