[sword-svn] r2750 - in trunk/bindings/objc: . ObjCSword.xcodeproj src
mdbergmann at crosswire.org
mdbergmann at crosswire.org
Tue Dec 18 04:11:35 MST 2012
Author: mdbergmann
Date: 2012-12-18 04:11:35 -0700 (Tue, 18 Dec 2012)
New Revision: 2750
Added:
trunk/bindings/objc/src/DefaultFilterProvider.h
trunk/bindings/objc/src/DefaultFilterProvider.mm
trunk/bindings/objc/src/FilterProviderFactory.h
trunk/bindings/objc/src/FilterProviderFactory.mm
trunk/bindings/objc/src/SwordUtil.h
trunk/bindings/objc/src/SwordUtil.m
Modified:
trunk/bindings/objc/ObjCSword.h
trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
trunk/bindings/objc/src/SwordBible.h
trunk/bindings/objc/src/SwordBible.mm
trunk/bindings/objc/src/SwordCommentary.h
trunk/bindings/objc/src/SwordCommentary.mm
trunk/bindings/objc/src/SwordDictionary.h
trunk/bindings/objc/src/SwordDictionary.mm
trunk/bindings/objc/src/SwordManager.h
trunk/bindings/objc/src/SwordManager.mm
Log:
- some fixes to imports.
- added FilterProvider and FilterProviderFactory.
They have been created to add the possibility for application to override the default filters (render/strip).
To add a custom FilterProvider, subclass DefaultFilterProvider and override the methods that are required to return other filter instances.
Then initialize the Factory with this provider.
+[FilterProviderFactory initWithImpl:<your impl>]
Modified: trunk/bindings/objc/ObjCSword.h
===================================================================
--- trunk/bindings/objc/ObjCSword.h 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/ObjCSword.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -23,7 +23,7 @@
#import <ObjCSword/SwordBibleTextEntry.h>
#import <ObjCSword/SwordVerseManager.h>
#import <ObjCSword/SwordInstallSource.h>
-#import "SwordInstallSourceManager.h"
+#import <ObjCSword/SwordInstallSourceManager.h>
#import <ObjCSword/SwordModuleTextEntry.h>
#import <ObjCSword/SwordModuleTreeEntry.h>
#import <ObjCSword/VerseEnumerator.h>
Modified: trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
===================================================================
--- trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj 2012-12-18 11:11:35 UTC (rev 2750)
@@ -37,6 +37,12 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 8C92C5E680D42D8CA7372C1F /* FilterProviderFactory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C92C72ADACB017A434CD268 /* FilterProviderFactory.h */; };
+ 8C92C5F8212FBE600D41B567 /* SwordUtil.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C92C7B2EB245D47FEB5E3B0 /* SwordUtil.h */; };
+ 8C92CC5DBC97CC4797507817 /* DefaultFilterProvider.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C92C980D4DE32C7AB93159D /* DefaultFilterProvider.h */; };
+ 8C92CC7B68FDCDFFFB8B4A31 /* DefaultFilterProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8C92C0124F354F4CB4F294F9 /* DefaultFilterProvider.mm */; };
+ 8C92CE0B19FBB659FB8F8B71 /* FilterProviderFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8C92C25F57CB01957B086256 /* FilterProviderFactory.mm */; };
+ 8C92CE39E231FF9CAAB5308B /* SwordUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C92C291C40A77060C12A21B /* SwordUtil.m */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
A94EAC0B117B28920018B06F /* SwordBible.h in Headers */ = {isa = PBXBuildFile; fileRef = A94EABE3117B28910018B06F /* SwordBible.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -337,6 +343,7 @@
A954ACDB13EEA5340094E3FE /* untgz.c in Sources */ = {isa = PBXBuildFile; fileRef = A954A8F713EE98B30094E3FE /* untgz.c */; };
A954ACDC13EEA5340094E3FE /* zutil.c in Sources */ = {isa = PBXBuildFile; fileRef = A954A8F813EE98B30094E3FE /* zutil.c */; };
A954ACDD13EEA6780094E3FE /* libsword.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A954ABC313EE9AB00094E3FE /* libsword.dylib */; };
+ A967FB5616806B16004ED73C /* teixhtml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9E9C5ED16806A2B00ECEB39 /* teixhtml.cpp */; };
A975EAC511C77862007C1532 /* ObjCSword.h in Headers */ = {isa = PBXBuildFile; fileRef = A975EAC411C77862007C1532 /* ObjCSword.h */; settings = {ATTRIBUTES = (Public, ); }; };
A975EEE511C79308007C1532 /* mod2osis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A975EDAC11C7925C007C1532 /* mod2osis.cpp */; };
A9A2C17D118D9D3D0002873D /* Notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = A9A2C17C118D9D3D0002873D /* Notifications.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -392,6 +399,7 @@
A9D4360611C4FE97007AFE83 /* SwordModule+Index.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9D4360411C4FE97007AFE83 /* SwordModule+Index.mm */; };
A9D4382311C52947007AFE83 /* locales.d in Resources */ = {isa = PBXBuildFile; fileRef = A9D437CE11C52947007AFE83 /* locales.d */; };
A9D9FA0B13EEE5CF00EA9DEB /* libsword.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A954ABC313EE9AB00094E3FE /* libsword.dylib */; };
+ A9E9C5EE16806A2B00ECEB39 /* teixhtml.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9E9C5ED16806A2B00ECEB39 /* teixhtml.cpp */; };
A9EF1416120595650078A27C /* SwordLocaleManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A9EF1414120595650078A27C /* SwordLocaleManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
A9EF1417120595650078A27C /* SwordLocaleManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9EF1415120595650078A27C /* SwordLocaleManager.mm */; };
/* End PBXBuildFile section */
@@ -659,6 +667,9 @@
dstSubfolderSpec = 10;
files = (
A9D9FA0B13EEE5CF00EA9DEB /* libsword.dylib in CopyFiles */,
+ 8C92C5F8212FBE600D41B567 /* SwordUtil.h in CopyFiles */,
+ 8C92C5E680D42D8CA7372C1F /* FilterProviderFactory.h in CopyFiles */,
+ 8C92CC5DBC97CC4797507817 /* DefaultFilterProvider.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -670,6 +681,12 @@
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF5E0370ADEE00C91783 /* ObjCSword_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCSword_Prefix.pch; sourceTree = "<group>"; };
+ 8C92C0124F354F4CB4F294F9 /* DefaultFilterProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DefaultFilterProvider.mm; path = src/DefaultFilterProvider.mm; sourceTree = "<group>"; };
+ 8C92C25F57CB01957B086256 /* FilterProviderFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FilterProviderFactory.mm; path = src/FilterProviderFactory.mm; sourceTree = "<group>"; };
+ 8C92C291C40A77060C12A21B /* SwordUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SwordUtil.m; path = src/SwordUtil.m; sourceTree = "<group>"; };
+ 8C92C72ADACB017A434CD268 /* FilterProviderFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FilterProviderFactory.h; path = src/FilterProviderFactory.h; sourceTree = "<group>"; };
+ 8C92C7B2EB245D47FEB5E3B0 /* SwordUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwordUtil.h; path = src/SwordUtil.h; sourceTree = "<group>"; };
+ 8C92C980D4DE32C7AB93159D /* DefaultFilterProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultFilterProvider.h; path = src/DefaultFilterProvider.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* ObjCSword.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ObjCSword.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A9013D3F11E316C700E1CCCA /* Info copy.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info copy.plist"; sourceTree = "<group>"; };
@@ -1180,6 +1197,7 @@
A9D4360311C4FE97007AFE83 /* SwordModule+Index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SwordModule+Index.h"; path = "src/SwordModule+Index.h"; sourceTree = "<group>"; };
A9D4360411C4FE97007AFE83 /* SwordModule+Index.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "SwordModule+Index.mm"; path = "src/SwordModule+Index.mm"; sourceTree = "<group>"; };
A9D437CE11C52947007AFE83 /* locales.d */ = {isa = PBXFileReference; lastKnownFileType = folder; name = locales.d; path = ../../locales.d; sourceTree = SOURCE_ROOT; };
+ A9E9C5ED16806A2B00ECEB39 /* teixhtml.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = teixhtml.cpp; sourceTree = "<group>"; };
A9EF1414120595650078A27C /* SwordLocaleManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwordLocaleManager.h; path = src/SwordLocaleManager.h; sourceTree = "<group>"; };
A9EF1415120595650078A27C /* SwordLocaleManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SwordLocaleManager.mm; path = src/SwordLocaleManager.mm; sourceTree = "<group>"; };
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@@ -1474,6 +1492,12 @@
A94EABF4117B28920018B06F /* SwordInstallSourceManager.mm */,
A9D4360311C4FE97007AFE83 /* SwordModule+Index.h */,
A9D4360411C4FE97007AFE83 /* SwordModule+Index.mm */,
+ 8C92C291C40A77060C12A21B /* SwordUtil.m */,
+ 8C92C7B2EB245D47FEB5E3B0 /* SwordUtil.h */,
+ 8C92C25F57CB01957B086256 /* FilterProviderFactory.mm */,
+ 8C92C72ADACB017A434CD268 /* FilterProviderFactory.h */,
+ 8C92C0124F354F4CB4F294F9 /* DefaultFilterProvider.mm */,
+ 8C92C980D4DE32C7AB93159D /* DefaultFilterProvider.h */,
);
name = SwordWrapper;
sourceTree = "<group>";
@@ -1691,6 +1715,7 @@
A954A85413EE98B30094E3FE /* filters */ = {
isa = PBXGroup;
children = (
+ A9E9C5ED16806A2B00ECEB39 /* teixhtml.cpp */,
A954A85513EE98B30094E3FE /* cipherfil.cpp */,
A954A85613EE98B30094E3FE /* gbffootnotes.cpp */,
A954A85713EE98B30094E3FE /* gbfheadings.cpp */,
@@ -2849,6 +2874,10 @@
A9C2858311C44A0A00803CB5 /* Configuration.m in Sources */,
A9D4360611C4FE97007AFE83 /* SwordModule+Index.mm in Sources */,
A9EF1417120595650078A27C /* SwordLocaleManager.mm in Sources */,
+ 8C92CE39E231FF9CAAB5308B /* SwordUtil.m in Sources */,
+ 8C92CE0B19FBB659FB8F8B71 /* FilterProviderFactory.mm in Sources */,
+ 8C92CC7B68FDCDFFFB8B4A31 /* DefaultFilterProvider.mm in Sources */,
+ A9E9C5EE16806A2B00ECEB39 /* teixhtml.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2856,6 +2885,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ A967FB5616806B16004ED73C /* teixhtml.cpp in Sources */,
A954ACCA13EEA5340094E3FE /* ftplib.c in Sources */,
A954ACCB13EEA5340094E3FE /* ftpparse.c in Sources */,
A954ACCD13EEA5340094E3FE /* adler32.c in Sources */,
Added: trunk/bindings/objc/src/DefaultFilterProvider.h
===================================================================
--- trunk/bindings/objc/src/DefaultFilterProvider.h (rev 0)
+++ trunk/bindings/objc/src/DefaultFilterProvider.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -0,0 +1,44 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import <Foundation/Foundation.h>
+
+#ifdef __cplusplus
+#include <swmgr.h> // C++ Sword API
+#endif
+
+ at protocol FilterProvider
+
+#ifdef __cplusplus
+- (sword::SWFilter *)newOsisRenderFilter;
+- (sword::SWFilter *)newOsisPlainFilter;
+- (sword::SWFilter *)newGbfRenderFilter;
+- (sword::SWFilter *)newGbfPlainFilter;
+- (sword::SWFilter *)newThmlRenderFilter;
+- (sword::SWFilter *)newThmlPlainFilter;
+- (sword::SWFilter *)newTeiRenderFilter;
+- (sword::SWFilter *)newTeiPlainFilter;
+- (sword::SWFilter *)newHtmlPlainFilter;
+#endif
+
+ at end
+
+ at interface DefaultFilterProvider : NSObject <FilterProvider>
+
+#ifdef __cplusplus
+- (sword::SWFilter *)newOsisRenderFilter;
+- (sword::SWFilter *)newOsisPlainFilter;
+- (sword::SWFilter *)newGbfRenderFilter;
+- (sword::SWFilter *)newGbfPlainFilter;
+- (sword::SWFilter *)newThmlRenderFilter;
+- (sword::SWFilter *)newThmlPlainFilter;
+- (sword::SWFilter *)newTeiRenderFilter;
+- (sword::SWFilter *)newTeiPlainFilter;
+- (sword::SWFilter *)newHtmlPlainFilter;
+#endif
+
+ at end
\ No newline at end of file
Added: trunk/bindings/objc/src/DefaultFilterProvider.mm
===================================================================
--- trunk/bindings/objc/src/DefaultFilterProvider.mm (rev 0)
+++ trunk/bindings/objc/src/DefaultFilterProvider.mm 2012-12-18 11:11:35 UTC (rev 2750)
@@ -0,0 +1,59 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+//
+
+
+#import "DefaultFilterProvider.h"
+
+#include "gbfplain.h"
+#include "thmlplain.h"
+#include "osisplain.h"
+#include "teiplain.h"
+#include "markupfiltmgr.h"
+#include "osishtmlhref.h"
+#include "thmlhtmlhref.h"
+#include "gbfhtmlhref.h"
+#include "teihtmlhref.h"
+#include "plainhtml.h"
+
+
+ at implementation DefaultFilterProvider
+
+- (sword::SWFilter *)newOsisRenderFilter {
+ return new sword::OSISHTMLHREF();
+}
+
+- (sword::SWFilter *)newOsisPlainFilter {
+ return new sword::OSISPlain();
+}
+
+- (sword::SWFilter *)newGbfRenderFilter {
+ return new sword::GBFHTMLHREF();
+}
+
+- (sword::SWFilter *)newGbfPlainFilter {
+ return new sword::GBFPlain();
+}
+
+- (sword::SWFilter *)newThmlRenderFilter {
+ return new sword::ThMLHTMLHREF();
+}
+
+- (sword::SWFilter *)newThmlPlainFilter {
+ return new sword::ThMLPlain();
+}
+
+- (sword::SWFilter *)newTeiRenderFilter {
+ return new sword::TEIHTMLHREF();
+}
+
+- (sword::SWFilter *)newTeiPlainFilter {
+ return new sword::TEIPlain();
+}
+
+- (sword::SWFilter *)newHtmlPlainFilter {
+ return new sword::PLAINHTML();
+}
+
+ at end
\ No newline at end of file
Added: trunk/bindings/objc/src/FilterProviderFactory.h
===================================================================
--- trunk/bindings/objc/src/FilterProviderFactory.h (rev 0)
+++ trunk/bindings/objc/src/FilterProviderFactory.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -0,0 +1,24 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+//
+
+#import <Foundation/Foundation.h>
+
+#ifdef __cplusplus
+#include <swmgr.h> // C++ Sword API
+#endif
+
+ at protocol FilterProvider;
+
+/**
+* This factory has to be initialized before any Modules are loaded through SwordManager.
+*/
+ at interface FilterProviderFactory : NSObject
+
++ (FilterProviderFactory *)providerFactory;
+
+- (void)initWithImpl:(id<FilterProvider>)aFilterProvider;
+- (id<FilterProvider>)get;
+
+ at end
Added: trunk/bindings/objc/src/FilterProviderFactory.mm
===================================================================
--- trunk/bindings/objc/src/FilterProviderFactory.mm (rev 0)
+++ trunk/bindings/objc/src/FilterProviderFactory.mm 2012-12-18 11:11:35 UTC (rev 2750)
@@ -0,0 +1,42 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+//
+
+
+#import "FilterProviderFactory.h"
+#import "DefaultFilterProvider.h"
+
+ at interface FilterProviderFactory ()
+
+ at property(nonatomic, retain) id <FilterProvider> filterProvider;
+
+ at end
+
+ at implementation FilterProviderFactory
+
++ (FilterProviderFactory *)providerFactory {
+ static FilterProviderFactory *singleton = nil;
+
+ if(singleton == nil) {
+ singleton = [[FilterProviderFactory alloc] init];
+ }
+
+ return singleton;
+}
+
+- (void)initWithImpl:(id <FilterProvider>)aFilterProvider {
+ self.filterProvider = aFilterProvider;
+}
+
+- (id <FilterProvider>)get {
+ return self.filterProvider;
+}
+
+- (void)dealloc {
+ self.filterProvider = nil;
+ [super dealloc];
+}
+
+
+ at end
\ No newline at end of file
Modified: trunk/bindings/objc/src/SwordBible.h
===================================================================
--- trunk/bindings/objc/src/SwordBible.h 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordBible.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -12,13 +12,13 @@
*/
#import <Foundation/Foundation.h>
-#import "SwordModule.h"
#ifdef __cplusplus
#import "versekey.h"
#endif
- at class SwordManager, SwordBibleBook, SwordModuleTextEntry, SwordBibleTextEntry;
+ at class SwordModule, SwordManager, SwordBibleBook, SwordModuleTextEntry, SwordBibleTextEntry;
+ at class SwordKey;
typedef enum {
OldTestament = 1,
Modified: trunk/bindings/objc/src/SwordBible.mm
===================================================================
--- trunk/bindings/objc/src/SwordBible.mm 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordBible.mm 2012-12-18 11:11:35 UTC (rev 2750)
@@ -11,13 +11,7 @@
General Public License for more details. (http://www.gnu.org/licenses/gpl.html)
*/
-#import "SwordBible.h"
-#import "SwordManager.h"
-#import "SwordBibleBook.h"
-#import "SwordListKey.h"
-#import "SwordModuleTextEntry.h"
-#import "SwordBibleTextEntry.h"
-#import "SwordVerseKey.h"
+#import <ObjCSword/ObjCSword.h>
using sword::AttributeTypeList;
using sword::AttributeList;
Modified: trunk/bindings/objc/src/SwordCommentary.h
===================================================================
--- trunk/bindings/objc/src/SwordCommentary.h 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordCommentary.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -12,7 +12,7 @@
*/
#import <Foundation/Foundation.h>
-#import "SwordBible.h"
+#import <ObjCSword/ObjCSword.h>
#ifdef __cplusplus
#include <rawfiles.h>
@@ -20,6 +20,8 @@
class sword::SWConfig;
#endif
+
+
@interface SwordCommentary : SwordBible {
}
Modified: trunk/bindings/objc/src/SwordCommentary.mm
===================================================================
--- trunk/bindings/objc/src/SwordCommentary.mm 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordCommentary.mm 2012-12-18 11:11:35 UTC (rev 2750)
@@ -12,7 +12,6 @@
*/
#import "SwordCommentary.h"
-#import "Configuration.h"
@implementation SwordCommentary
Modified: trunk/bindings/objc/src/SwordDictionary.h
===================================================================
--- trunk/bindings/objc/src/SwordDictionary.h 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordDictionary.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -12,9 +12,8 @@
*/
#import <Foundation/Foundation.h>
-#import "SwordModule.h"
- at class SwordManager;
+ at class SwordManager, SwordModule;
@interface SwordDictionary : SwordModule {
/** only keys are buffered here */
Modified: trunk/bindings/objc/src/SwordDictionary.mm
===================================================================
--- trunk/bindings/objc/src/SwordDictionary.mm 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordDictionary.mm 2012-12-18 11:11:35 UTC (rev 2750)
@@ -11,8 +11,7 @@
General Public License for more details. (http://www.gnu.org/licenses/gpl.html)
*/
-#import "SwordDictionary.h"
-#import "Configuration.h"
+#import <ObjCSword/ObjCSword.h>
@interface SwordDictionary (/* Private, class continuation */)
/** private property */
Modified: trunk/bindings/objc/src/SwordManager.h
===================================================================
--- trunk/bindings/objc/src/SwordManager.h 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordManager.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -17,14 +17,6 @@
#ifdef __cplusplus
#include <swmgr.h> // C++ Sword API
#include <localemgr.h>
-#include <markupfiltmgr.h>
-// Filters
-#include <markupfiltmgr.h>
-#include <osishtmlhref.h>
-#include <thmlhtmlhref.h>
-#include <gbfhtmlhref.h>
-#include <teihtmlhref.h>
-#include <plainhtml.h>
#include <versekey.h>
class sword::SWModule;
#endif
@@ -110,13 +102,12 @@
// CipherKeys NSUserdefaultsKey
#define DefaultsModuleCipherKeysKey @"DefaultsModuleCipherKeysKey"
-
@interface SwordManager : NSObject {
#ifdef __cplusplus
sword::SWMgr *swManager;
sword::SWFilter *plainFilter, *thmlFilter, *gbfFilter, *osisFilter, *teiFilter;
- sword::SWFilter *thmlStripFilter, *gbfStripFilter, *osisStripFilter;
+ sword::SWFilter *thmlStripFilter, *gbfStripFilter, *osisStripFilter, *teiStripFilter;
#endif
NSDictionary *modules;
@@ -134,7 +125,7 @@
// --------------------- methods -----------------------
/**
- Conveniance initializer. Creates an instance of SwordManager for a given module path.
+ Convenience initializer. Creates an instance of SwordManager for a given module path.
Internally -initWithPath: is called.
*/
+ (SwordManager *)managerWithPath:(NSString*)path;
@@ -147,19 +138,12 @@
+ (SwordManager *)defaultManager;
/**
- Retreve a list of known module types.
+ Retrieve a list of known module types.
See SWMOD_CATEGORY_*
*/
+ (NSArray *)moduleTypes;
/**
- Rendered Module text that has links.
- This method will return a dictionary with attribute/value pairs from parameters of the link.
- See ATTRTYPE_* for key types.
- */
-+ (NSDictionary *)linkDataForLinkURL:(NSURL *)aURL;
-
-/**
Initializes this manager for the given module path.
*/
- (id)initWithPath:(NSString *)path;
@@ -167,10 +151,10 @@
/**
Add an additional path to the manager to augment more modules.
*/
-- (void)addPath:(NSString*)path;
+- (void)addModulesPath:(NSString*)path;
/**
- reinit - reloads all modules, filters and such
+ re-init - reloads all modules, filters and such
This will be triggered if new module had been installed in the module installer.
*/
- (void)reInit;
@@ -233,6 +217,7 @@
Returns the underlying sword::SWMgr instance
*/
- (sword::SWMgr *)swManager;
+
#endif
@end
Modified: trunk/bindings/objc/src/SwordManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordManager.mm 2012-12-18 01:03:42 UTC (rev 2749)
+++ trunk/bindings/objc/src/SwordManager.mm 2012-12-18 11:11:35 UTC (rev 2750)
@@ -11,16 +11,13 @@
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 "gbfplain.h"
-#include "thmlplain.h"
-#include "osisplain.h"
+#import <ObjCSword/ObjCSword.h>
#import "Notifications.h"
+#import "FilterProviderFactory.h"
+#import "DefaultFilterProvider.h"
+#include "encfiltmgr.h"
+
using std::string;
using std::list;
@@ -60,47 +57,54 @@
- (void)addFiltersToModule:(sword::SWModule *)mod {
// prepare display filters
+
+ id<FilterProvider> filterProvider = [[FilterProviderFactory providerFactory] get];
+
switch(mod->Markup()) {
case sword::FMT_GBF:
if(!gbfFilter) {
- gbfFilter = new sword::GBFHTMLHREF();
+ gbfFilter = [filterProvider newGbfRenderFilter];
}
if(!gbfStripFilter) {
- gbfStripFilter = new sword::GBFPlain();
+ gbfStripFilter = [filterProvider newGbfPlainFilter];
}
mod->AddRenderFilter(gbfFilter);
mod->AddStripFilter(gbfStripFilter);
break;
case sword::FMT_THML:
if(!thmlFilter) {
- thmlFilter = new sword::ThMLHTMLHREF();
+ thmlFilter = [filterProvider newThmlRenderFilter];
}
if(!thmlStripFilter) {
- thmlStripFilter = new sword::ThMLPlain();
+ thmlStripFilter = [filterProvider newThmlPlainFilter];
}
mod->AddRenderFilter(thmlFilter);
mod->AddStripFilter(thmlStripFilter);
break;
case sword::FMT_OSIS:
if(!osisFilter) {
- osisFilter = new sword::OSISHTMLHREF();
+ osisFilter = [filterProvider newOsisRenderFilter];
}
if(!osisStripFilter) {
- osisStripFilter = new sword::OSISPlain();
+ osisStripFilter = [filterProvider newOsisPlainFilter];
}
mod->AddRenderFilter(osisFilter);
mod->AddStripFilter(osisStripFilter);
break;
case sword::FMT_TEI:
if(!teiFilter) {
- teiFilter = new sword::TEIHTMLHREF();
+ teiFilter = [filterProvider newTeiRenderFilter];
}
+ if(!teiStripFilter) {
+ teiStripFilter = [filterProvider newTeiPlainFilter];
+ }
mod->AddRenderFilter(teiFilter);
+ mod->AddStripFilter(teiStripFilter);
break;
case sword::FMT_PLAIN:
default:
if(!plainFilter) {
- plainFilter = new sword::PLAINHTML();
+ plainFilter = [filterProvider newHtmlPlainFilter];
}
mod->AddRenderFilter(plainFilter);
break;
@@ -118,56 +122,6 @@
# pragma mark - class methods
-+ (NSDictionary *)linkDataForLinkURL:(NSURL *)aURL {
- NSMutableDictionary *ret = [NSMutableDictionary dictionary];
-
- NSString *scheme = [aURL scheme];
- if([scheme isEqualToString:@"sword"]) {
- // in this case host is the module and path the reference
- [ret setObject:[aURL host] forKey:ATTRTYPE_MODULE];
- [ret setObject:[[[aURL path] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
- stringByReplacingOccurrencesOfString:@"/" withString:@""]
- forKey:ATTRTYPE_VALUE];
- [ret setObject:@"scriptRef" forKey:ATTRTYPE_TYPE];
- [ret setObject:@"showRef" forKey:ATTRTYPE_ACTION];
- } else if([scheme isEqualToString:@"applewebdata"]) {
- // in this case
- NSString *path = [aURL path];
- NSString *query = [aURL query];
- if([[path lastPathComponent] isEqualToString:@"passagestudy.jsp"]) {
- NSArray *data = [query componentsSeparatedByString:@"&"];
- NSString *type = @"x";
- NSString *module = @"";
- NSString *passage = @"";
- NSString *value = @"1";
- NSString *action = @"";
- for(NSString *entry in data) {
- if([entry hasPrefix:@"type="]) {
- type = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
- } else if([entry hasPrefix:@"module="]) {
- module = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
- } else if([entry hasPrefix:@"passage="]) {
- passage = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
- } else if([entry hasPrefix:@"action="]) {
- action = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
- } else if([entry hasPrefix:@"value="]) {
- value = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
- } else {
- ALog(@"Unknown parameter: %@", entry);
- }
- }
-
- [ret setObject:module forKey:ATTRTYPE_MODULE];
- [ret setObject:passage forKey:ATTRTYPE_PASSAGE];
- [ret setObject:value forKey:ATTRTYPE_VALUE];
- [ret setObject:action forKey:ATTRTYPE_ACTION];
- [ret setObject:type forKey:ATTRTYPE_TYPE];
- }
- }
-
- return ret;
-}
-
+ (NSArray *)moduleTypes {
return [NSArray arrayWithObjects:
SWMOD_TYPES_BIBLES,
@@ -200,7 +154,7 @@
self.modulesPath = path;
self.modules = [NSDictionary dictionary];
- self.managerLock = [(NSLock *)[[NSRecursiveLock alloc] init] autorelease];
+ self.managerLock = (NSLock *)[[[NSRecursiveLock alloc] init] autorelease];
[self reInit];
@@ -288,14 +242,13 @@
// clear some data
[self refreshModules];
- SendNotifyModulesChanged(nil);
+ SendNotifyModulesChanged(NULL);
}
}
[managerLock unlock];
}
-- (void)addPath:(NSString *)path {
-
+- (void)addModulesPath:(NSString *)path {
[managerLock lock];
if(swManager == nil) {
swManager = new sword::SWMgr([path UTF8String], true, new sword::EncodingFilterMgr(sword::ENC_UTF8));
@@ -306,7 +259,7 @@
[self refreshModules];
[managerLock unlock];
- SendNotifyModulesChanged(nil);
+ SendNotifyModulesChanged(NULL);
}
- (SwordModule *)moduleWithName:(NSString *)name {
Added: trunk/bindings/objc/src/SwordUtil.h
===================================================================
--- trunk/bindings/objc/src/SwordUtil.h (rev 0)
+++ trunk/bindings/objc/src/SwordUtil.h 2012-12-18 11:11:35 UTC (rev 2750)
@@ -0,0 +1,20 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import <Foundation/Foundation.h>
+
+
+ at interface SwordUtil : NSObject
+
+/**
+ Rendered Module texts may have hyperlinks. Those links may have key/value pairs to target data.
+ This method will return a dictionary with attribute/value pairs from parameters of the link.
+ See ATTRTYPE_* for key types.
+ */
++ (NSDictionary *)dictionaryFromUrl:(NSURL *)aURL;
+
+ at end
Added: trunk/bindings/objc/src/SwordUtil.m
===================================================================
--- trunk/bindings/objc/src/SwordUtil.m (rev 0)
+++ trunk/bindings/objc/src/SwordUtil.m 2012-12-18 11:11:35 UTC (rev 2750)
@@ -0,0 +1,64 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import <ObjCSword/ObjCSword.h>
+#import "SwordUtil.h"
+
+
+ at implementation SwordUtil
+
++ (NSDictionary *)dictionaryFromUrl:(NSURL *)aURL {
+ NSMutableDictionary *ret = [NSMutableDictionary dictionary];
+
+ NSString *scheme = [aURL scheme];
+ if([scheme isEqualToString:@"sword"]) {
+ // in this case host is the module and path the reference
+ [ret setObject:[aURL host] forKey:ATTRTYPE_MODULE];
+ [ret setObject:[[[aURL path] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
+ stringByReplacingOccurrencesOfString:@"/" withString:@""]
+ forKey:ATTRTYPE_VALUE];
+ [ret setObject:@"scriptRef" forKey:ATTRTYPE_TYPE];
+ [ret setObject:@"showRef" forKey:ATTRTYPE_ACTION];
+ } else if([scheme isEqualToString:@"applewebdata"]) {
+ // in this case
+ NSString *path = [aURL path];
+ NSString *query = [aURL query];
+ if([[path lastPathComponent] isEqualToString:@"passagestudy.jsp"]) {
+ NSArray *data = [query componentsSeparatedByString:@"&"];
+ NSString *type = @"x";
+ NSString *module = @"";
+ NSString *passage = @"";
+ NSString *value = @"1";
+ NSString *action = @"";
+ for(NSString *entry in data) {
+ if([entry hasPrefix:@"type="]) {
+ type = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
+ } else if([entry hasPrefix:@"module="]) {
+ module = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
+ } else if([entry hasPrefix:@"passage="]) {
+ passage = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
+ } else if([entry hasPrefix:@"action="]) {
+ action = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
+ } else if([entry hasPrefix:@"value="]) {
+ value = [[entry componentsSeparatedByString:@"="] objectAtIndex:1];
+ } else {
+ ALog(@"Unknown parameter: %@", entry);
+ }
+ }
+
+ [ret setObject:module forKey:ATTRTYPE_MODULE];
+ [ret setObject:passage forKey:ATTRTYPE_PASSAGE];
+ [ret setObject:value forKey:ATTRTYPE_VALUE];
+ [ret setObject:action forKey:ATTRTYPE_ACTION];
+ [ret setObject:type forKey:ATTRTYPE_TYPE];
+ }
+ }
+
+ return ret;
+}
+
+ at end
\ No newline at end of file
More information about the sword-cvs
mailing list