This is MiscExporter.rtf in view mode; [Download] [Up]
Version 2.0, Copyright ©1996, 1997 by Paul S. McCarthy and Eric Sunshine. All Rights Reserved.
Paul S. McCarthy and Eric Sunshine -- July 4, 1997
MiscExporter
Inherits From: NSObject
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 columnTitleMode;
MiscExportGridMode rowGrid;
MiscExportGridMode columnGrid;
tableScroll The table scroll object to export.
exportFormat Output format.
rowTitleMode Row title option setting.
columnTitleMode Column title option setting.
rowGrid Row grid option setting.
columnGrid Column grid option setting.
Method Types
Initializing + commonInstance
± init
Exporting ± exportTableScroll:
± exportTableScroll:toFilename:
Setting and getting attributes ± getColumnExportGridMode
± getColumnExportTitleMode
± getExportFormat
± getRowExportGridMode
± getRowExportTitleMode
± setColumnExportGridMode:
± setColumnExportTitleMode:
± 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 NSSavePanel 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:(NSString*)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.
getColumnExportGridMode
- (MiscExportGridMode)getColumnExportGridMode
Returns columnGrid.
getColumnExportTitleMode
- (MiscExportTitleMode)getColumnExportTitleMode
Returns columnTitleMode.
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
columnTitleMode MISC_EXPORT_TITLES_ON
rowGrid MISC_EXPORT_GRID_OFF
columnGrid MISC_EXPORT_GRID_LINE
Returns self.
setColumnExportGridMode:
- (void)setColumnExportGridMode:(MiscExportGridMode)gridMode
Assigns gridMode to columnGrid. Column 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.
setColumnExportTitleMode:
- (void)setColumnExportTitleMode:(MiscExportTitleMode)titleMode
Assigns titleMode to columnTitle. Column 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. Column 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 -setColumnExportGridMode:.
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 -setColumnExportTitleMode:.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.