ReadViewSDK/Doc/WXRead/decompiled/WRPageUnderline.h

102 lines
3.2 KiB
Objective-C

//
// WRPageUnderline.h
// WeRead (读书)
// Reverse-engineered header
//
// Annotation model for text underlines. 10 methods identified from binary.
// Supports multiple underline styles (solid, dashed, wavy, etc.)
// and is associated with a text range in a chapter.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class WRBookmark;
// ---------------------------------------------------------------------------
// Underline styles
// ---------------------------------------------------------------------------
typedef NS_ENUM(NSInteger, WRUnderlineStyle) {
WRUnderlineStyleSolid = 0, // ____
WRUnderlineStyleDashed = 1, // ----
WRUnderlineStyleWavy = 2, // ~~~~
WRUnderlineStyleDotted = 3, // ....
};
// ---------------------------------------------------------------------------
// WRPageUnderline
// ---------------------------------------------------------------------------
@interface WRPageUnderline : NSObject
@property (nonatomic, copy) NSString *underlineId;
@property (nonatomic, copy) NSString *bookId;
@property (nonatomic, copy) NSString *chapterUid;
@property (nonatomic, assign) NSInteger startPos;
@property (nonatomic, assign) NSInteger endPos;
@property (nonatomic, assign) NSInteger chapterOffset;
@property (nonatomic, copy) NSString *markedText;
@property (nonatomic, assign) WRUnderlineStyle style;
@property (nonatomic, strong, nullable) UIColor *color;
@property (nonatomic, assign) NSInteger pageIndex;
@property (nonatomic, assign) NSTimeInterval createTime;
@property (nonatomic, assign) BOOL isSynced;
@property (nonatomic, copy, nullable) NSString *noteContent; // attached note
#pragma mark - Initialization
/// Initialize with text range and style.
- (instancetype)initWithBookId:(NSString *)bookId
chapterUid:(NSString *)chapterUid
startPos:(NSInteger)startPos
endPos:(NSInteger)endPos
text:(NSString *)text
style:(WRUnderlineStyle)style;
#pragma mark - Conversion
/// Convert to a WRBookmark for persistence/sync.
- (WRBookmark *)toBookmark;
/// Create from an existing bookmark.
+ (nullable instancetype)fromBookmark:(WRBookmark *)bookmark;
#pragma mark - Drawing
/// Return the underline path for rendering in a given rect.
- (UIBezierPath *)underlinePathForRect:(CGRect)rect;
/// Return the underline color.
- (UIColor *)underlineColor;
#pragma mark - Methods (10 identified from binary, reconstructed)
/// Update the underline style.
- (void)setStyle:(WRUnderlineStyle)style;
/// Update the note content attached to this underline.
- (void)setNote:(NSString *)note;
/// Check if a given position falls within this underline's range.
- (BOOL)containsPosition:(NSInteger)position;
/// Merge with another underline (adjacent ranges).
- (BOOL)mergeWithUnderline:(WRPageUnderline *)other;
/// Return the text range length.
- (NSInteger)rangeLength;
/// Return a serialized dictionary.
- (NSDictionary *)toDictionary;
/// Create from a serialized dictionary.
+ (nullable instancetype)fromDictionary:(NSDictionary *)dict;
/// Compare two underlines for ordering (by start position).
- (NSComparisonResult)compareTo:(WRPageUnderline *)other;
@end
NS_ASSUME_NONNULL_END