summaryrefslogtreecommitdiff
path: root/bindings/objc/src/SwordModule.h
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/objc/src/SwordModule.h')
-rw-r--r--bindings/objc/src/SwordModule.h91
1 files changed, 52 insertions, 39 deletions
diff --git a/bindings/objc/src/SwordModule.h b/bindings/objc/src/SwordModule.h
index ee47da7..9f1e0ad 100644
--- a/bindings/objc/src/SwordModule.h
+++ b/bindings/objc/src/SwordModule.h
@@ -11,15 +11,13 @@
General Public License for more details. (http://www.gnu.org/licenses/gpl.html)
*/
-#import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
#ifdef __cplusplus
#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 passagestudy
+// defines for dictionary entries for passage study
#define ATTRTYPE_TYPE @"type"
#define ATTRTYPE_PASSAGE @"passage"
#define ATTRTYPE_MODULE @"modulename"
@@ -33,6 +31,7 @@
@class SwordManager, SwordModuleTextEntry, SwordKey;
+@class SwordFilter;
typedef enum {
TextTypeStripped = 1,
@@ -41,6 +40,7 @@ typedef enum {
/** These are the main module types as returned in -typeString */
typedef enum {
+ All = 0x0000,
Bible = 0x0001,
Commentary = 0x0002,
Dictionary = 0x0004,
@@ -74,7 +74,11 @@ typedef enum {
NSLock *indexLock;
/** we store the name separately */
+ NSString *typeString;
NSString *name;
+ NSString *descr;
+ NSString *lang;
+
/** yes, we have a delegate to report any action to */
id delegate;
@@ -89,19 +93,44 @@ typedef enum {
@property (readwrite) int status;
@property (retain, readwrite) NSRecursiveLock *moduleLock;
@property (retain, readwrite) NSLock *indexLock;
-@property (retain, readwrite) NSString *name;
@property (retain, readwrite) SwordManager *swManager;
+// swmodule properties
+@property (retain, readonly) NSString *name;
+@property (retain, readonly) NSString *typeString;
+@property (retain, readonly) NSString *descr;
+@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 andName:(NSString *)aName swModule:(sword::SWModule *)swModule swordManager:(SwordManager *)aManager;
++ (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
/**
@@ -125,22 +154,12 @@ typedef enum {
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?
@@ -150,18 +169,6 @@ typedef enum {
// --------------- Conf entries --------------
/**
- Module description
- */
-- (NSString *)descr;
-/**
- Module language
- */
-- (NSString *)lang;
-/**
- Module type as string
- */
-- (NSString *)typeString;
-/**
Module category as string
*/
- (NSString *)categoryString;
@@ -254,20 +261,20 @@ typedef enum {
/**
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 ------------------
@@ -286,6 +293,7 @@ typedef enum {
@return NSString for text data
*/
- (id)attributeValueForParsedLinkData:(NSDictionary *)data;
+- (id)attributeValueForParsedLinkData:(NSDictionary *)data withTextRenderType:(TextPullType)textType;
/** returns the pre-verse entry value */
- (NSString *)entryAttributeValuePreverse;
@@ -307,6 +315,11 @@ typedef enum {
Convenience method with a key-string
*/
- (SwordModuleTextEntry *)textEntryForKeyString:(NSString *)aKeyString textType:(TextPullType)aType;
+/**
+ Pulls all text entries for the given reference
+ @return Array of SwordModuleTextEntry
+ */
+- (NSArray *)textEntriesForReference:(NSString *)aReference textType:(TextPullType)textType;
/**
Returns a rendered text for the text at the current module position