//
//  CFFIndex.h
//  GSFontTools
//
//  Created by Georg Seifert on 01.08.11.
//  Copyright 2011 schriftgestaltung.de. All rights reserved.
//

#import <GSFontTools/CFFVersion.h>

@class CFFIndexedStrings;
@class GSFileData;
@class GSXMLWriter;

NS_ASSUME_NONNULL_BEGIN

/// This class represents what the CFF spec calls an INDEX (an array of
/// variable-sized objects). `Index` items can be addressed and set using
/// Python list indexing.
// class Index:
@interface CFFIndex : NSObject <NSFastEnumeration>

@property CFFVersion version;

@property (nonatomic, readonly) NSMutableArray *items;

- (instancetype)initWithFile:(nullable GSFileData *)file
		   version:(CFFVersion)version;

- (Class)compilerClass;

@property (nonatomic, readonly) NSUInteger count;

- (id)itemAtIndex:(NSUInteger)aIndex;
- (void)setItem:(id)item atIndex:(NSUInteger)index;
- (id)produceItem:(NSUInteger)idx /*data:(NSData*)Data*/ file:(GSFileData *)file offset:(NSUInteger)offset size:(NSUInteger)size;
//- (id)produceItem:(NSUInteger)i data:(NSData*)Data file:(GSFileData*)File offset:(NSUInteger)offset size:(NSUInteger)size;
//- (id)produceItem:(NSUInteger)i data:(GSFileData*)File offset:(NSUInteger)offset size:(NSUInteger)size;
- (void)addItem:(id)item;

- (void)toXML:(GSXMLWriter *)writer;

- (void)fromXML:(NSString *)name attrs:(NSDictionary *)attrs content:(id)content;

- (id)compiler:(nullable CFFIndexedStrings *)strings parent:(id)parent version:(CFFVersion)version;

@end

NS_ASSUME_NONNULL_END
