//
//  translatorBase.h
//  Data_Editor
//
//  Created by otusweb on Mon Feb 10 2003.
//  Copyright (c) 2003 Texas Instrument Inc.. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <TIConnectManagerXInteraction/TIConnectManagerXInteraction.h>
#import <TIConnectManagerXInteraction/NSNumber+hexString.h>

typedef enum translatorError {
    TIOriginFileNotExistant 		= 1,
    TIDestinationFileAlreadyExists  = 2,
    TIBadInputFormat				= 4,
    TIBadOutputFormat				= 8,
    TIDestinationFileReadOnly		= 16,
    TICouldNotLaunchHelper			= 32,
    TIConversionError				= 64,
    TIInvalidName					= 128,
    TIUserCancelled					= 256
    
} TITranslationError;

extern NSString *conversionError;

@interface TITranslatorBase : NSObject {
    NSURL					*fileToConvertURL;
    NSURL					*destinationFile;
    NSData					*computerFileData;
    NSAppleEventDescriptor  *TIFileContentToTranslate;
    
    NSDictionary			*translatorInformation;
    DescType				originFormat;
    DescType				destinationFormat;
    DescType				defaultComputerTranslationFormat;
    NSString				*deviceFileName;
    NSString				*originalPlatform;
    NSString				*destinationPlatform;
    NSString				*folderName;
    NSString				*preferredApplicationToOpenFileCreatorCode;
    SInt32					objectVersion;
	NSAppleEventDescriptor  *objectFlagsDescriptor;
}

- (long)convertFile:(NSURL *)inFile
		 toPlatform:(NSString *)inPlatform
			 toFile:(NSURL *)fileToCreate;
+ (long)convertFile:(NSURL *)inFile
		 toPlatform:(NSString *)inPlatform
			 toFile:(NSURL *)fileToCreate;
+ (NSString *)extensionForResultOfConversionOfFile:(NSURL *)inFile
                                        toPlatform:(NSString *)inPlatform;
- (NSString *)extensionForResultOfConversionOfFile:(NSURL *)inFile
                                        toPlatform:(NSString *)inPlatform;
+ (NSString *)extensionForPlatform:(NSString *)inDestination;
- (NSString *)extensionForPlatform:(NSString *)inDestination;

    //C wrapped methods
    //
long convertFile(CFURLRef inFileToConvert,
				 CFStringRef toPlatform,
				 CFURLRef fileToCreate,
				 CFBundleRef conversionBundle);
long convertFileContents(CFDataRef fileContent,
						 CFStringRef fromPlatform,
						 CFStringRef toPlatform,
						 CFDataRef *returnedData,
						 CFBundleRef conversionBundle);
CFStringRef extensionForResultOfConversionOfFile(CFURLRef inFile,
												 CFStringRef inPlatform,
												 CFBundleRef conversionBundle);

@end