//
//  GSAnchor.h
//  GlyphsCore
//
//  Created by Georg Seifert on 10.8.08.
//  Copyright 2008 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSElement.h>

NS_ASSUME_NONNULL_BEGIN

/**
 Defines the type of anchor.

 @constant BaseAnchor The anchor is a base anchor.
 @constant MarkAnchor The anchor is a mark anchor.
 */
typedef NS_ENUM(uint8_t, GSAnchorType) {
	BaseAnchor = 0,
	MarkAnchor = 1
};

/**
 The class defining the anchor object.
 */
@interface GSAnchor : GSElement <NSCoding, NSCopying> {
	NSString *_name;
}

- (instancetype)initWithName:(NSString *)name position:(CGPoint)position;

/**
 Name of the anchor.
 */
@property (copy, nonatomic) NSString *name;

/**
 The context of the anchor.
 */
@property (strong, nonatomic) NSString *context;

/**
 Checks if the anchor is equal to another anchor.

 @param other The other anchor to compare against.
 @return YES if the anchors are equal, NO otherwise.
 */
- (BOOL)isEqualToAnchor:(GSAnchor *)other;

/**
 Sets the name of the anchor quickly without copying the string.

 @param name The new name for the anchor.
 */
- (void)setNameFast:(NSString *)name;

@end

NS_ASSUME_NONNULL_END
