Sha256: a80350c36d76d0edfa41c674fc93ba0262623b749e6cb7f0ca629ce90a16ea00

Contents?: true

Size: 1.85 KB

Versions: 3

Compression:

Stored size: 1.85 KB

Contents

#import "YapDatabaseFullTextSearchSnippetOptions.h"


@implementation YapDatabaseFullTextSearchSnippetOptions

+ (NSString *)defaultStartMatchText {
	return @"<b>";
}

+ (NSString *)defaultEndMatchText {
	return @"</b>";
}

+ (NSString *)defaultEllipsesText {
	return @"...";
}

+ (int)defaultNumberOfTokens {
	return 15;
}

@synthesize startMatchText = startMatchText;
@synthesize endMatchText = endMatchText;
@synthesize ellipsesText = ellipsesText;
@synthesize columnName = columnName;
@synthesize numberOfTokens = numberOfTokens;

- (id)init
{
	if ((self = [super init]))
	{
		startMatchText = [[self class] defaultStartMatchText];
		endMatchText = [[self class] defaultEndMatchText];
		ellipsesText = [[self class] defaultEllipsesText];
		
		numberOfTokens = [[self class] defaultNumberOfTokens];
	}
	return self;
}

- (id)initForCopy
{
	if ((self = [super init]))
	{
		// copyWithZone will fill out values for us
	}
	return self;
}

- (id)copyWithZone:(NSZone *)zone
{
	YapDatabaseFullTextSearchSnippetOptions *copy = [[YapDatabaseFullTextSearchSnippetOptions alloc] initForCopy];
	
	copy->startMatchText = startMatchText;
	copy->endMatchText = endMatchText;
	copy->ellipsesText = ellipsesText;
	copy->columnName = columnName;
	copy->numberOfTokens = numberOfTokens;
	
	return copy;
}

- (void)setStartMatchText:(NSString *)text
{
	if (text)
		startMatchText = [text copy];
	else
		startMatchText = [[self class] defaultStartMatchText];
}

- (void)setEndMatchText:(NSString *)text
{
	if (text)
		endMatchText = [text copy];
	else
		endMatchText = [[self class] defaultEndMatchText];
}

- (void)setEllipsesText:(NSString *)text
{
	if (text)
		ellipsesText = [text copy];
	else
		ellipsesText = [[self class] defaultEllipsesText];
}

- (void)setNumberOfTokens:(int)count
{
	if (count != 0)
		numberOfTokens = count;
	else
		numberOfTokens = [[self class] defaultNumberOfTokens];
}

@end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
motion-yapper-0.0.3 vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m
motion-yapper-0.0.2 vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m
motion-yapper-0.0.1 vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m