//
//  M2StringDecoder.h
//  libmdb2
//
//  Created by Jakob Egger on 01.10.21.
//

#import <Foundation/Foundation.h>
#import <iconv.h>

NS_ASSUME_NONNULL_BEGIN

@interface M2StringDecoder : NSObject {
	BOOL have_string_encoding;
	NSStringEncoding *stringEncoding;
	UInt32 codepage;
	BOOL have_iconv;
	iconv_t cd;
}
-(instancetype)initWithCodepage:(UInt32)codepage error:(NSError *__nullable *__nullable)outError;
-(instancetype)initWithStringEncoding:(NSStringEncoding)encoding;

-(NSString *__nullable)newStringFromData:(NSData *)data error:(NSError *__nullable *__nullable)error;
-(NSString *__nullable)newStringFromBytes:(const void *)data length:(size_t)length error:(NSError *__nullable *__nullable)error;

@end


NS_ASSUME_NONNULL_END
