ftp.nice.ch/pub/next/science/chemistry/BeakerBoy.0.31.s.tar.gz#/BeakerBoy.0.31.s/FileManager.subproj/BBBeakerFilter.m

This is BBBeakerFilter.m in view mode; [Download] [Up]

/* BBMvtxFilter.m				 
 *
 * This format filter does handle read/write of molecules in the
 * MoleViewer Text (.mvt) fileformat.
 *
 * For interface-info see the header file. The comments in this file mostly
 * cover only the real implementation details.
 *
 * Written by: 		Thomas Engel
 * Created:    		15.03.1994 (Copyleft)
 * Last modified: 	14.05.1994
 */

#import "BBMvtxFilter.h"
#import "BBFileFilterManager.h"
#import "../BBAppManager.h"
#import "../AtomLibrary.subproj/BBAtomLibraryManager.h"

#import "../BBBeaker.h"
#import "../BBMolecule.h"
#import "../BBAtom.h"
#import "../BBBond.h"

#import <misckit/MiscString.h>
#import "../MiscString_ExtendedParsing.h"

#define MYBUFFERSIZE		500
#define COMMENTTOKEN		"#"
#define ELLIPSEDATATOKEN	"ELLIPSE"

#define SINGLEBONDTOKEN		"S"
#define DOUBLEBONDTOKEN		"D"
#define AROMATICBONDTOKEN	"A"

// I hate statics but here they might be useful.
// The other variables have been added to the intercase to allow debugging.

static char lineBuffer[MYBUFFERSIZE];
static FILE	*inStream;

@implementation BBMvtxFilter

- (float)canReadFile:(const char*)filename
{
	// Let's see if we can handle the file. Well this is a stupid check.
	// Right now we only check the file extention. If its "mvt" we
	// will do it.
	// Normally we should return (0, 0.5, 1) according to the percentage of
	// data we understand. More a fuzzy logic with MAYBE.
	
	id		pathString;
	id		aString;
	float	answer;
	
	pathString = [MiscString new];
	[pathString setPath:filename];
	aString = [pathString fileExtension];
	
	if( [aString casecmp:"beaker"] == 0 )
			answer = (float)YES;
	else	answer = (float)NO;
	
	[pathString free];
	[aString free];
	
	return answer;
}

- readBeaker:aBeaker fromFile:(const char*)filename
{	
	// Well all we do is unarchive the stored Beaker hirarchie.
	// So lets free the beaker we got passed along and simple of 
}

- writeBeaker:aBeaker toFile:(const char *)filename
{
	return self;
}

@end

/*
 * History: 30.10.94 Switched to the MiscString.
 *
 *			14.05.94 Changes to work with new BB... objects.
 *
 *			15.03.94 A basic implementation.
 *
 *
 * Bugs: - We could check the MVTX Magic word instead of relying on the file-
 *		   extension.
 *
 *		 - Does not handle Eliptic, charge and labeling info (15.03.94)
 */

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