ftp.nice.ch/pub/next/developer/objc/dbkit/SimpleTableView.1.0.s.tar.gz#/SimpleTableView-1/DataTable.h

This is DataTable.h in view mode; [Download] [Up]

// -------------------------------------------------------------------------------------
//  DataTable
//  This software is without warranty of any kind.  Use at your own risk.
// -------------------------------------------------------------------------------------

#import <objc/Object.h>

// -------------------------------------------------------------------------------------
// column data types
#define CDT_TYPES			"?SBI"
#define	CDT_UNKNOWN			0
#define	CDT_STRING			1
#define	CDT_BOOLEAN			2
#define	CDT_INTEGER			3

// -------------------------------------------------------------------------------------
// column definition
#define	DATATYPE_UNDEFINED	0
typedef struct {
	int						index;			// physical ordering (0 == key)
	char					*keyTag;		// lookup key name buffer
	char					*title;			// column title
	char					type;			// data type
	NXCoord					size;			// width of column
	NXCoord					minSize;		// minimum size of column
	int						displayOrder;	// displayed ordering
	int						alignment;		// column content alignment
	BOOL					isEditable;		// content editability
	BOOL					isHidden;		// don't show column
	char					*nilValue;		// value equivalent to "empty"
} dataColumn_t;

// -------------------------------------------------------------------------------------
// table definition
typedef struct {
	char					*name;
	char					*access;
	NXSize					viewSize;
	time_t					date;
	id						columnId;
	id						reorderId;
	id						dataId;
} dataTable_t;

// -------------------------------------------------------------------------------------
// row:colmn entry
typedef struct {
	char					*value;
	int						isValid;	/* -1, 0, 1 */
} dataEntry_t;

#define entryNEW				((dataEntry_t*)malloc(sizeof(dataEntry_t)))
#define entryPTR(R,C)			((R)?(dataEntry_t*)[(R) objectAt:(C)]:(dataEntry_t*)nil)
#define entryVALUE(R,C)			(entryPTR(R,C)->value)
#define entryVALID(R,C)			(entryPTR(R,C)->isValid)

// -------------------------------------------------------------------------------------
@interface DataTable : Object
{

	id						delegate;
	
	id						nullIndex;
	BOOL					isModified;

	dataTable_t				*tableHandle;
	
}

// -------------------------------------------------------------------------------------

- initFromFile:(const char*)fileName;
- free;

- setDelegate:aDelegate;
- delegate;
- setNullIndex:index;
- setViewSize:(NXSize*)size;
- (const NXSize*)viewSize;

- (BOOL)tableHasChanged;
- setDocEdited:(BOOL)flag;
- commitTable;

- newRowName:(const char*)rowN copyFromRow:(int)rowX;
- deleteRowAt:(int)rowX;

- (int)sortCompare:(dataColumn_t*)dc values:(const char*)val1:(const char*)val2;
- sortTableByColumn:(int)pri :(int)sec;
- sortTableByColumnName:(const char*)priName :(const char*)secName;

+ (dataColumn_t*)_column:infoId infoAt:(int)n;
- (dataColumn_t*)columnInfoAt:(u_int)col;
- (const char*)copyStringValue:(const char*)value forColumn:(int)index;
- (dataColumn_t*)orderedColumnInfoAt:(u_int)ord;
- addColumnInfo:(dataColumn_t*)dc;
- setDisplayOrder:(int)order andWidth:(float)width forColumnIndex:(int)column;

- (const char*)tableName;
- (const char*)tableTitle;
- (const char*)tableAccess;
- (u_int)actualColumnCount;
- (u_int)visibleColumnCount;
- (u_int)columnCount;
- (u_int)rowCount;

- (BOOL)hasVerificationErrors;
- (BOOL)verifyValueAt:(u_int)row :(u_int)column;
- (BOOL)verifyValue:(const char*)value dataType:(int)dataType;

- (int)indexForColumnName:(const char*)name;
- (int)indexForRowName:(const char*)rowN exactMatch:(BOOL)exact;
- (dataEntry_t*)entryAtIndex:(u_int)rowX :(u_int)colX;
- (const char*)valueForRowName:(const char*)rowN columnName:(const char*)colN;
- (const char*)valueAtIndex:(u_int)rowX :(u_int)colX;
- (const char*)valueFor:(u_int)rowIndex :(u_int)columnIndex;
- setValue:(const char*)value atIndex:(u_int)rowX :(u_int)colX;
- setValue:(const char*)value forRowName:(const char*)rowN columnName:(const char*)colN;
- setValueFor:rowIndex :colIndex from:aValue;
- setValueFor:colIndex at:(u_int)rowPosition from:aValue;
- getValueFor:rowIndex :columnIndex into:aValue;
- getValueFor:index at:(u_int)aPosition into:aValue;
- (int)scanForValue:(const char*)value inColumnName:(const char*)colN
	startingAtRow:(int)rowX backwards:(BOOL)back;

- (time_t)timestamp;
- readTableColumns;
- readTableData;
- writeTable;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.