[sword-svn] r2751 - in trunk/bindings/objc: ObjCSword.xcodeproj src
mdbergmann at crosswire.org
mdbergmann at crosswire.org
Wed Dec 19 12:45:45 MST 2012
Author: mdbergmann
Date: 2012-12-19 12:45:45 -0700 (Wed, 19 Dec 2012)
New Revision: 2751
Added:
trunk/bindings/objc/src/SwordFilter.h
trunk/bindings/objc/src/SwordFilter.mm
Modified:
trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
trunk/bindings/objc/src/DefaultFilterProvider.h
trunk/bindings/objc/src/DefaultFilterProvider.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
Log:
Added ObjC wrappers for the Sword filter classes. Mainly because in Eloquent project it is not possible to access any of the plain C++ Sword stuff. Wrappers are necessary.
Modified: trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
===================================================================
--- trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj 2012-12-19 19:45:45 UTC (rev 2751)
@@ -37,8 +37,10 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
+ 8C92C31DC92DF0671FCEB5B3 /* SwordFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8C92CC111DC521DE0C054C60 /* SwordFilter.mm */; };
8C92C5E680D42D8CA7372C1F /* FilterProviderFactory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C92C72ADACB017A434CD268 /* FilterProviderFactory.h */; };
8C92C5F8212FBE600D41B567 /* SwordUtil.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C92C7B2EB245D47FEB5E3B0 /* SwordUtil.h */; };
+ 8C92CA44C1F2D85EE4A21B63 /* SwordFilter.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8C92C02A5C86E1C75ED1CEF4 /* SwordFilter.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 */; };
@@ -670,6 +672,7 @@
8C92C5F8212FBE600D41B567 /* SwordUtil.h in CopyFiles */,
8C92C5E680D42D8CA7372C1F /* FilterProviderFactory.h in CopyFiles */,
8C92CC5DBC97CC4797507817 /* DefaultFilterProvider.h in CopyFiles */,
+ 8C92CA44C1F2D85EE4A21B63 /* SwordFilter.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -682,11 +685,13 @@
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>"; };
+ 8C92C02A5C86E1C75ED1CEF4 /* SwordFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwordFilter.h; path = src/SwordFilter.h; 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>"; };
+ 8C92CC111DC521DE0C054C60 /* SwordFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SwordFilter.mm; path = src/SwordFilter.mm; 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>"; };
@@ -1498,6 +1503,8 @@
8C92C72ADACB017A434CD268 /* FilterProviderFactory.h */,
8C92C0124F354F4CB4F294F9 /* DefaultFilterProvider.mm */,
8C92C980D4DE32C7AB93159D /* DefaultFilterProvider.h */,
+ 8C92CC111DC521DE0C054C60 /* SwordFilter.mm */,
+ 8C92C02A5C86E1C75ED1CEF4 /* SwordFilter.h */,
);
name = SwordWrapper;
sourceTree = "<group>";
@@ -2878,6 +2885,7 @@
8C92CE0B19FBB659FB8F8B71 /* FilterProviderFactory.mm in Sources */,
8C92CC7B68FDCDFFFB8B4A31 /* DefaultFilterProvider.mm in Sources */,
A9E9C5EE16806A2B00ECEB39 /* teixhtml.cpp in Sources */,
+ 8C92C31DC92DF0671FCEB5B3 /* SwordFilter.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/bindings/objc/src/DefaultFilterProvider.h
===================================================================
--- trunk/bindings/objc/src/DefaultFilterProvider.h 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/src/DefaultFilterProvider.h 2012-12-19 19:45:45 UTC (rev 2751)
@@ -6,39 +6,32 @@
#import <Foundation/Foundation.h>
+#import "SwordFilter.h"
-#ifdef __cplusplus
-#include <swmgr.h> // C++ Sword API
-#endif
-
@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
+- (SwordFilter *)newOsisRenderFilter;
+- (SwordFilter *)newOsisPlainFilter;
+- (SwordFilter *)newGbfRenderFilter;
+- (SwordFilter *)newGbfPlainFilter;
+- (SwordFilter *)newThmlRenderFilter;
+- (SwordFilter *)newThmlPlainFilter;
+- (SwordFilter *)newTeiRenderFilter;
+- (SwordFilter *)newTeiPlainFilter;
+- (SwordFilter *)newHtmlPlainFilter;
@end
@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
+- (SwordFilter *)newOsisRenderFilter;
+- (SwordFilter *)newOsisPlainFilter;
+- (SwordFilter *)newGbfRenderFilter;
+- (SwordFilter *)newGbfPlainFilter;
+- (SwordFilter *)newThmlRenderFilter;
+- (SwordFilter *)newThmlPlainFilter;
+- (SwordFilter *)newTeiRenderFilter;
+- (SwordFilter *)newTeiPlainFilter;
+- (SwordFilter *)newHtmlPlainFilter;
- at end
\ No newline at end of file
+ at end
Modified: trunk/bindings/objc/src/DefaultFilterProvider.mm
===================================================================
--- trunk/bindings/objc/src/DefaultFilterProvider.mm 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/src/DefaultFilterProvider.mm 2012-12-19 19:45:45 UTC (rev 2751)
@@ -5,55 +5,44 @@
#import "DefaultFilterProvider.h"
+#import "SwordFilter.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"
-
-
@implementation DefaultFilterProvider
-- (sword::SWFilter *)newOsisRenderFilter {
- return new sword::OSISHTMLHREF();
+- (SwordFilter *)newOsisRenderFilter {
+ return [SwordOsisHtmlRefFilter filter];
}
-- (sword::SWFilter *)newOsisPlainFilter {
- return new sword::OSISPlain();
+- (SwordFilter *)newOsisPlainFilter {
+ return [SwordOsisPlainFilter filter];
}
-- (sword::SWFilter *)newGbfRenderFilter {
- return new sword::GBFHTMLHREF();
+- (SwordFilter *)newGbfRenderFilter {
+ return [SwordGbfHtmlFilter filter];
}
-- (sword::SWFilter *)newGbfPlainFilter {
- return new sword::GBFPlain();
+- (SwordFilter *)newGbfPlainFilter {
+ return [SwordGbfPlainFilter filter];
}
-- (sword::SWFilter *)newThmlRenderFilter {
- return new sword::ThMLHTMLHREF();
+- (SwordFilter *)newThmlRenderFilter {
+ return [SwordThmlHtmlFilter filter];
}
-- (sword::SWFilter *)newThmlPlainFilter {
- return new sword::ThMLPlain();
+- (SwordFilter *)newThmlPlainFilter {
+ return [SwordThmlPlainFilter filter];
}
-- (sword::SWFilter *)newTeiRenderFilter {
- return new sword::TEIHTMLHREF();
+- (SwordFilter *)newTeiRenderFilter {
+ return [SwordTeiHtmlFilter filter];
}
-- (sword::SWFilter *)newTeiPlainFilter {
- return new sword::TEIPlain();
+- (SwordFilter *)newTeiPlainFilter {
+ return [SwordTeiPlainFilter filter];
}
-- (sword::SWFilter *)newHtmlPlainFilter {
- return new sword::PLAINHTML();
+- (SwordFilter *)newHtmlPlainFilter {
+ return [SwordPlainHtmlFilter filter];
}
@end
\ No newline at end of file
Added: trunk/bindings/objc/src/SwordFilter.h
===================================================================
--- trunk/bindings/objc/src/SwordFilter.h (rev 0)
+++ trunk/bindings/objc/src/SwordFilter.h 2012-12-19 19:45:45 UTC (rev 2751)
@@ -0,0 +1,65 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import <Foundation/Foundation.h>
+
+#ifdef __cplusplus
+#include <swfilter.h>
+#endif
+
+ at interface SwordFilter : NSObject
+
+#ifdef __cplusplus
+- (id)initWithSWFilter:(sword::SWFilter *)swFilter;
+- (sword::SWFilter *)swFilter;
+#endif
+
+ at end
+
+ at interface SwordOsisHtmlRefFilter : SwordFilter
++ (SwordOsisHtmlRefFilter *)filter;
+ at end
+
+ at interface SwordOsisPlainFilter : SwordFilter
++ (SwordOsisPlainFilter *)filter;
+ at end
+
+ at interface SwordOsisXHtmlFilter : SwordFilter
++ (SwordOsisXHtmlFilter *)filter;
+ at end
+
+ at interface SwordThmlHtmlFilter : SwordFilter
++ (SwordThmlHtmlFilter *)filter;
+ at end
+
+ at interface SwordThmlPlainFilter : SwordFilter
++ (SwordThmlPlainFilter *)filter;
+ at end
+
+ at interface SwordGbfHtmlFilter : SwordFilter
++ (SwordGbfHtmlFilter *)filter;
+ at end
+
+ at interface SwordGbfPlainFilter : SwordFilter
++ (SwordGbfPlainFilter *)filter;
+ at end
+
+ at interface SwordTeiHtmlFilter : SwordFilter
++ (SwordTeiHtmlFilter *)filter;
+ at end
+
+ at interface SwordTeiXHtmlFilter : SwordFilter
++ (SwordTeiXHtmlFilter *)filter;
+ at end
+
+ at interface SwordTeiPlainFilter : SwordFilter
++ (SwordTeiPlainFilter *)filter;
+ at end
+
+ at interface SwordPlainHtmlFilter : SwordFilter
++ (SwordPlainHtmlFilter *)filter;
+ at end
Added: trunk/bindings/objc/src/SwordFilter.mm
===================================================================
--- trunk/bindings/objc/src/SwordFilter.mm (rev 0)
+++ trunk/bindings/objc/src/SwordFilter.mm 2012-12-19 19:45:45 UTC (rev 2751)
@@ -0,0 +1,152 @@
+//
+// Created by mbergmann on 18.12.12.
+//
+// To change the template use AppCode | Preferences | File Templates.
+//
+
+
+#import "SwordFilter.h"
+#import "osishtmlhref.h"
+#import "osisplain.h"
+#import "osisxhtml.h"
+#import "thmlhtmlhref.h"
+#import "thmlplain.h"
+#import "gbfhtmlhref.h"
+#import "gbfplain.h"
+#import "teihtmlhref.h"
+#import "teixhtml.h"
+#import "teiplain.h"
+#import "plainhtml.h"
+
+ at implementation SwordFilter {
+ sword::SWFilter *swFilter;
+}
+
+- (id)initWithSWFilter:(sword::SWFilter *)swFilter1 {
+ self = [super init];
+ if (self) {
+ swFilter = swFilter1;
+ }
+
+ return self;
+}
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+- (sword::SWFilter *)swFilter {
+ return swFilter;
+}
+
+ at end
+
+ at implementation SwordOsisHtmlRefFilter
++ (SwordOsisHtmlRefFilter *)filter {
+ return [[[SwordOsisHtmlRefFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::OSISHTMLHREF()];
+}
+ at end
+
+ at implementation SwordOsisXHtmlFilter
++ (SwordOsisXHtmlFilter *)filter {
+ return [[[SwordOsisXHtmlFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::OSISXHTML()];
+}
+ at end
+
+ at implementation SwordOsisPlainFilter
++ (SwordOsisPlainFilter *)filter {
+ return [[[SwordOsisPlainFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::OSISPlain()];
+}
+ at end
+
+ at implementation SwordThmlHtmlFilter
++ (SwordThmlHtmlFilter *)filter {
+ return [[[SwordThmlHtmlFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::ThMLHTMLHREF()];
+}
+ at end
+
+ at implementation SwordThmlPlainFilter
++ (SwordThmlPlainFilter *)filter {
+ return [[[SwordThmlPlainFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::ThMLPlain()];
+}
+ at end
+
+ at implementation SwordGbfHtmlFilter
++ (SwordGbfHtmlFilter *)filter {
+ return [[[SwordGbfHtmlFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::ThMLHTMLHREF()];
+}
+ at end
+
+ at implementation SwordGbfPlainFilter
++ (SwordGbfPlainFilter *)filter {
+ return [[[SwordGbfPlainFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::ThMLPlain()];
+}
+ at end
+
+ at implementation SwordTeiHtmlFilter
++ (SwordTeiHtmlFilter *)filter {
+ return [[[SwordTeiHtmlFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::TEIHTMLHREF()];
+}
+ at end
+
+ at implementation SwordTeiXHtmlFilter
++ (SwordTeiXHtmlFilter *)filter {
+ return [[[SwordTeiXHtmlFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::TEIXHTML()];
+}
+ at end
+
+ at implementation SwordTeiPlainFilter
++ (SwordTeiPlainFilter *)filter {
+ return [[[SwordTeiPlainFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::TEIPlain()];
+}
+ at end
+
+ at implementation SwordPlainHtmlFilter
++ (SwordPlainHtmlFilter *)filter {
+ return [[[SwordPlainHtmlFilter alloc] init] autorelease];
+}
+
+- (id)init {
+ return [super initWithSWFilter:new sword::PLAINHTML()];
+}
+ at end
Modified: trunk/bindings/objc/src/SwordManager.h
===================================================================
--- trunk/bindings/objc/src/SwordManager.h 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/src/SwordManager.h 2012-12-19 19:45:45 UTC (rev 2751)
@@ -106,8 +106,8 @@
#ifdef __cplusplus
sword::SWMgr *swManager;
- sword::SWFilter *plainFilter, *thmlFilter, *gbfFilter, *osisFilter, *teiFilter;
- sword::SWFilter *thmlStripFilter, *gbfStripFilter, *osisStripFilter, *teiStripFilter;
+ SwordFilter *plainFilter, *thmlFilter, *gbfFilter, *osisFilter, *teiFilter;
+ SwordFilter *thmlStripFilter, *gbfStripFilter, *osisStripFilter, *teiStripFilter;
#endif
NSDictionary *modules;
Modified: trunk/bindings/objc/src/SwordManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordManager.mm 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/src/SwordManager.mm 2012-12-19 19:45:45 UTC (rev 2751)
@@ -17,6 +17,7 @@
#import "DefaultFilterProvider.h"
#include "encfiltmgr.h"
+#import "SwordFilter.h"
using std::string;
using std::list;
@@ -24,7 +25,7 @@
@interface SwordManager (PrivateAPI)
- (void)refreshModules;
-- (void)addFiltersToModule:(sword::SWModule *)mod;
+- (void)addFiltersToModule:(SwordModule *)mod;
@end
@@ -47,7 +48,7 @@
SwordModule *sm = [SwordModule moduleForType:aType swModule:mod swordManager:self];
[dict setObject:sm forKey:[[sm name] lowercaseString]];
- [self addFiltersToModule:mod];
+ [self addFiltersToModule:sm];
}
}
@@ -55,12 +56,12 @@
self.modules = dict;
}
-- (void)addFiltersToModule:(sword::SWModule *)mod {
+- (void)addFiltersToModule:(SwordModule *)mod {
// prepare display filters
id<FilterProvider> filterProvider = [[FilterProviderFactory providerFactory] get];
- switch(mod->Markup()) {
+ switch([mod swModule]->Markup()) {
case sword::FMT_GBF:
if(!gbfFilter) {
gbfFilter = [filterProvider newGbfRenderFilter];
@@ -68,8 +69,8 @@
if(!gbfStripFilter) {
gbfStripFilter = [filterProvider newGbfPlainFilter];
}
- mod->AddRenderFilter(gbfFilter);
- mod->AddStripFilter(gbfStripFilter);
+ [mod addRenderFilter:gbfFilter];
+ [mod addStripFilter:gbfStripFilter];
break;
case sword::FMT_THML:
if(!thmlFilter) {
@@ -78,8 +79,8 @@
if(!thmlStripFilter) {
thmlStripFilter = [filterProvider newThmlPlainFilter];
}
- mod->AddRenderFilter(thmlFilter);
- mod->AddStripFilter(thmlStripFilter);
+ [mod addRenderFilter:thmlFilter];
+ [mod addStripFilter:thmlStripFilter];
break;
case sword::FMT_OSIS:
if(!osisFilter) {
@@ -88,8 +89,8 @@
if(!osisStripFilter) {
osisStripFilter = [filterProvider newOsisPlainFilter];
}
- mod->AddRenderFilter(osisFilter);
- mod->AddStripFilter(osisStripFilter);
+ [mod addRenderFilter:osisFilter];
+ [mod addStripFilter:osisStripFilter];
break;
case sword::FMT_TEI:
if(!teiFilter) {
@@ -98,15 +99,15 @@
if(!teiStripFilter) {
teiStripFilter = [filterProvider newTeiPlainFilter];
}
- mod->AddRenderFilter(teiFilter);
- mod->AddStripFilter(teiStripFilter);
+ [mod addRenderFilter:teiFilter];
+ [mod addStripFilter:teiStripFilter];
break;
case sword::FMT_PLAIN:
default:
if(!plainFilter) {
plainFilter = [filterProvider newHtmlPlainFilter];
}
- mod->AddRenderFilter(plainFilter);
+ [mod addRenderFilter:plainFilter];
break;
}
}
@@ -199,7 +200,16 @@
[self setModules:nil];
[self setModulesPath:nil];
[self setManagerLock:nil];
-
+
+ [gbfFilter release];
+ [gbfStripFilter release];
+ [thmlFilter release];
+ [thmlStripFilter release];
+ [osisFilter release];
+ [osisStripFilter release];
+ [teiFilter release];
+ [teiStripFilter release];
+ [plainFilter release];
[super dealloc];
}
Modified: trunk/bindings/objc/src/SwordModule.h
===================================================================
--- trunk/bindings/objc/src/SwordModule.h 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/src/SwordModule.h 2012-12-19 19:45:45 UTC (rev 2751)
@@ -17,8 +17,6 @@
#import "swmodule.h"
#endif
-#define My_SWDYNAMIC_CAST(className, object) (sword::className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
-
// defines for dictionary entries for passage study
#define ATTRTYPE_TYPE @"type"
#define ATTRTYPE_PASSAGE @"passage"
@@ -33,6 +31,7 @@
@class SwordManager, SwordModuleTextEntry, SwordKey;
+ at class SwordFilter;
typedef enum {
TextTypeStripped = 1,
@@ -103,15 +102,35 @@
@property (retain, readonly) NSString *lang;
#ifdef __cplusplus
+
/**
- Convenience initializers
+ Convenience initializer
*/
+ (id)moduleForSWModule:(sword::SWModule *)aModule;
+ (id)moduleForSWModule:(sword::SWModule *)aModule swordManager:(SwordManager *)aManager;
+
/**
Factory method that creates the correct module type instance for the given type
*/
+ (id)moduleForType:(ModuleType)aType swModule:(sword::SWModule *)swModule swordManager:(SwordManager *)aManager;
+
+/**
+ Initialize this module with an the SWModule.
+ This initializer should normally not need to be used.
+ */
+- (id)initWithSWModule:(sword::SWModule *)aModule;
+
+/**
+ Initialize this module with an the SWModule and a SwordManager instance.
+ This initializer should normally not need to be used.
+ */
+- (id)initWithSWModule:(sword::SWModule *)aModule swordManager:(SwordManager *)aManager;
+
+/**
+ Retrieve the underlying SWModule instance
+ */
+- (sword::SWModule *)swModule;
+
#endif
/**
@@ -135,23 +154,13 @@
The SwordManager is needed because the underlying SWModule is retrieved from SwordManager.
*/
- (id)initWithName:(NSString *)aName swordManager:(SwordManager *)aManager;
-#ifdef __cplusplus
-/**
- Initialize this module with an the SWModule.
- This initializer should normally not need to be used.
- */
-- (id)initWithSWModule:(sword::SWModule *)aModule;
-/**
- Initialize this module with an the SWModule and a SwordManager instance.
- This initializer should normally not need to be used.
- */
-- (id)initWithSWModule:(sword::SWModule *)aModule swordManager:(SwordManager *)aManager;
-/**
- Retrieve the underlying SWModule instance
- */
-- (sword::SWModule *)swModule;
-#endif
+/** Adds a render filter to this module */
+- (void)addRenderFilter:(SwordFilter *)aFilter;
+
+/** Adds a strip filter to this module */
+- (void)addStripFilter:(SwordFilter *)aFilter;
+
/**
Any error while processing the module?
*/
Modified: trunk/bindings/objc/src/SwordModule.mm
===================================================================
--- trunk/bindings/objc/src/SwordModule.mm 2012-12-18 11:11:35 UTC (rev 2750)
+++ trunk/bindings/objc/src/SwordModule.mm 2012-12-19 19:45:45 UTC (rev 2751)
@@ -20,6 +20,7 @@
#import "SwordCommentary.h"
#import "SwordDictionary.h"
#import "SwordBook.h"
+#import "SwordFilter.h"
@interface SwordModule ()
@@ -118,7 +119,7 @@
return ret;
}
-#pragma mark - Initializers
+#pragma mark - Initializer
- (void)mainInit {
category = Unset;
@@ -178,6 +179,16 @@
[super dealloc];
}
+#pragma mark - Filters
+
+- (void)addRenderFilter:(SwordFilter *)aFilter {
+ swModule->AddRenderFilter([aFilter swFilter]);
+}
+
+- (void)addStripFilter:(SwordFilter *)aFilter {
+ swModule->AddStripFilter([aFilter swFilter]);
+}
+
#pragma mark - Module access semaphores
- (void)lockModuleAccess {
More information about the sword-cvs
mailing list