This is TextConverter.m in view mode; [Download] [Up]
/***********************************************************************\ Common class for subclassing text converters in all Convert programs Copyright (C) 1993 David John Burrowes This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author, David John Burrowes, can be reached at: davidjohn@kira.net.netcom.com David John Burrowes 1926 Ivy #10 San Mateo, CA 94403-1367 \***********************************************************************/ /*==================================================================== This is the implementation file for the TextConverter class. Full documentation for this class can be found in the TextConverter.rtf file. I will not duplicate all that fine information here. NOTE: You may find that text doesn't line up properly unless you use the New Century Schoolbook Roman typeface, since this was created with it. INFORMATION: This is $Revision: 1.2 $ of this file It was last modified by $Author: death $ on $Date: 93/04/04 23:45:22 $ $Log: TextConverter.m,v $ Revision 1.2 93/04/04 23:45:22 death Sun Apr 4 23:45:22 PDT 1993 Revision 1.1 93/01/10 15:08:51 death Sun Jan 10 15:08:51 PST 1993 ====================================================================*/ #import "TextConverter.h" #import <string.h> // for memcpy @implementation TextConverter ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Routine: ConvertCharacter: // Parameters: a character to be converted // Returns: the converted character // Stores: the character that we are returning. // Description: // This merely returns the chracter that we were passed, thus providing the // trivial text conversion algorithm (everything maps to itself) // Bugs: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (Character) ConvertCharacter: (Character) theCharacter { [self ResetResults]; [self StoreErrorCode: errOK AndText: "Of course nothing went wrong!"]; [self StoreCharacter: theCharacter]; return theCharacter; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Routine: ConvertString:WithLength: // Parameters: a pointer to a string of data to be converted // the length of the data the poiner poins to. // Returns: a poiner to a new block of data to be converted // Stores: the pointer we are returning // the length of the new data // Description: // This converts the text in the source data area into a new area. // As with ConvertCharacter:, this really just returns to the caller exactly what // it passed us. // Bugs: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (Pointer) ConvertString: (Pointer) theData WithLength: (Integer) length { Pointer newData; [self ResetResults]; newData = NewPointer(length); memcpy(newData, theData, length); [self StoreErrorCode: errOK AndText: "Of course nothing went wrong!"]; [self StorePointer: theData]; [self PutPositiveInteger: length Into: SECOND_RESULT]; return theData; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.