Version 1.0, Copyright ã1996,1997 by Paul S. McCarthy and Eric Sunshine.  All Rights Reserved.
Paul S. McCarthy and Eric Sunshine  --  July 1, 1997

MiscExporter

Inherits From:	Object

Declared In:	MiscExporter.h

Class Description

This class provides an easy means to export the contents of an instance of MiscTableScroll in the following output formats:

ASCII fixed field widths
ASCII tab separated fields
ASCII delimited (quoted fields, comma-separated)
dBASEIII (.dbf)

Instance Variables

MiscTableScroll *tableScroll;
MiscExportFormat exportFormat;
MiscExportTitleMode rowTitleMode;
MiscExportTitleMode colTitleMode;
MiscExportGridMode rowGrid;
MiscExportGridMode colGrid;

tableScroll	The table scroll object to export.

exportFormat	Output format.

rowTitleMode	Row title option setting.

colTitleMode	Col title option setting.

rowGrid	Row grid option setting.

colGrid	Col grid option setting.

Method Types

	+ commonInstance
	± exportTableScroll:
	± exportTableScroll:toFilename:
	± getColExportGridMode
	± getColExportTitleMode
	± getExportFormat
	± getRowExportGridMode
	± getRowExportTitleMode
	± init
	± setColExportGridMode:
	± setColExportTitleMode:
	± setExportFormat:
	± setRowExportGridMode:
	± setRowExportTitleMode:

Class Methods

commonInstance
+ (MiscExporter*)commonInstance

Returns a pointer to a single shared instance, which can be used from anywhere.

Instance Methods

exportTableScroll:
-  (int)exportTableScroll:(MiscTableScroll*)ts

Runs the SavePanel with an accessory view for the user to choose the output filename and other options for exporting the MiscTableScroll, ts.  You can pre-initialize the MiscExporter object with any settings that you choose, but the user will be able to override your pre-set values via the accessory view on the SavePanel.  Returns zero (0) on success, minus one (-1) if the user pressed "Cancel" at the save panel, or the MiscTableScroll has no columns, or errno if there was an error opening or closing the file.

exportTableScroll:toFilename:
-  (int)exportTableScroll:(MiscTableScroll*)ts
toFilename:(char const*)filename

Uses the current option settings and exports the MiscTableScroll, ts, to filename, over-writing the file if it is present.  This method does not run the SavePanel.  Returns zero (0) on success, minus one (-1) if ts is NULL or has no columns, or errno if there was an error opening or closing the file.

getColExportGridMode
-  (MiscExportGridMode)getColExportGridMode

Returns colGrid.

getColExportTitleMode
-  (MiscExportTitleMode)getColExportTitleMode

Returns colTitleMode.

getExportFormat
-  (MiscExportFormat)getExportFormat

Returns exportFormat.

getRowExportGridMode
-  (MiscExportGridMode)getRowExportGridMode

Returns rowGrid.

getRowExportTitleMode
-  (MiscExportTitleMode)getRowExportTitleMode

Returns rowTitle.

init
-  (id)init

Initializes a newly allocated MiscExporter object.  The default settings are:

exportFormat	MISC_EXPORT_ASCII_FIXED
rowTitleMode	MISC_EXPORT_TITLES_OFF
colTitleMode	MISC_EXPORT_TITLES_ON
rowGrid	MISC_EXPORT_GRID_OFF
colGrid	MISC_EXPORT_GRID_LINE

Returns self.

setColExportGridMode:
-  (void)setColExportGridMode:(MiscExportGridMode)gridMode

Assigns gridMode to colGrid.  Col grid mode controls the  lines/spaces between columns in fixed-width ASCII output format.  The available values are:

typedef enum
	{
	MISC_EXPORT_GRID_OFF,	// No grid
	MISC_EXPORT_GRID_LINE,	// Lines, col-grid='|', row-grid='-'
	MISC_EXPORT_GRID_SPACE,	// Spaces col-grid=' ', row-grid=' '
	} MiscExportGridMode;

Grid mode only affects MISC_EXPORT_ASCII_FIXED export format.  The other output formats do not produce a grid of any kind under any circumstances.

setColExportTitleMode:
-  (void)setColExportTitleMode:(MiscExportTitleMode)titleMode

Assigns titleMode to colTitle.  Col title mode controls whether or not titles are included in the output for all ASCII formats, and controls the formatting of the titles for fixed-width ASCII output format.  Col title mode has no impact on dBASEIII (.dbf) output format.  The available values are:

typedef enum
	{
	MISC_EXPORT_TITLES_OFF,	// No titles.
	MISC_EXPORT_TITLES_ON,	// Full width, expand column if needed.
	MISC_EXPORT_TITLES_WRAP,	// Wrap titles within data width.
	MISC_EXPORT_TITLES_TRUNCATE,	// Truncate titles to data width.
	} MiscExportTitleMode;

setExportFormat:
-  (void)setExportFormat:(MiscExportFormat)format

Assigns format to exportFormat.  The available values are:

typedef enum
	{
	MISC_EXPORT_ASCII_FIXED,
	MISC_EXPORT_ASCII_TAB,
	MISC_EXPORT_ASCII_DELIMITED,
	MISC_EXPORT_DBF
	} MiscExportFormat;

setRowExportGridMode:
-  (void)setRowExportGridMode:(MiscExportGridMode)gridMode

Assigns gridMode to rowGrid.  See -setColExportGridMode:.

setRowExportTitleMode:
-  (void)setRowExportTitleMode:(MiscExportTitleMode)titleMode

Assigns titleMode to rowTitleMode.  Turning on titles will include physical row numbers if no explicit row titles have been set for the MiscTableScroll object.  Row titles are either on or off.  MISC_EXPORT_TITLES_OFF turns the titles off.  Any other value turns them on.  The other formatting values do not affect row titles.  See -setColExportTitleMode:.