/
BAFMobi.h
47 lines (39 loc) · 1.22 KB
/
BAFMobi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/** @file BAFMobi.h
*
* Copyright (c) 2015 Bartek Fabiszewski
* http://www.fabiszewski.net
*
* This file is part of QLMobi.
* Licensed under GPL, either version 3, or any later.
* See <http://www.gnu.org/licenses/>
*/
#ifndef BAFMobi_h
#define BAFMobi_h
/** kindle:embed:xxxx target length */
static const NSUInteger embedLinkLength = 4;
#import <Foundation/Foundation.h>
#import "BAFMobiPart.h"
typedef enum { SUCCESS, ERROR } Status;
/**
Basic wrapper for libmobi
*/
@interface BAFMobi : NSObject
/** init with url */
- (instancetype)initWithURL:(NSURL *)url andParse:(BOOL)withParse;
- (instancetype)initWithURL:(NSURL *)url;
/** get resource (part) for given link target */
- (BAFMobiPart *)partForLink:(NSString *)link;
/** iterate markup parts and call block callback on each part */
- (void)enumerateMarkupUsingBlock:(void(^)(BAFMobiPart *curr, BOOL *stop))callback;
/** iterate flow parts and call block callback on each part */
- (void)enumerateFlowUsingBlock:(void(^)(BAFMobiPart *curr, BOOL *stop))callback;
/** get cover image data */
- (NSData *)coverData;
/** get title */
- (NSString *)title;
/** get author */
- (NSString *)author;
/** is document version greater than 8 */
- (BOOL)isKF8;
@end
#endif /* BAFMobi_h */