//************************************************************************************** // Filename: CUTextFileStream.h // Copyright © 1999 Tomasz Kukielka. All rights reserved. // // Description: // //************************************************************************************** // Revision History: // Tuesday, May 4, 1999 - Original //************************************************************************************** #ifndef _H_CUTextFile #define _H_CUTextFile #pragma once #include "ConverterConstants.h" #include "AFileFork.h" #define HiByte(x) ((unsigned char)((unsigned short)(x) >> 8)) #define LoByte(x) ((unsigned char)(x)) #define SwapHiLoBytes(x) ( (unsigned short)((unsigned char)(x)<<8) | ((unsigned short)(x) >> 8) ) const Boolean kTextIsUnicode = true; const Boolean kTextIsNOTUnicode = false; class CUTextFileStream: public ARefFork { public: CUTextFileStream(const FSRef& inFileRef, SInt8 inPermissions); virtual ~CUTextFileStream(); // virtual ByteCount Read( ByteCount inCount, void *inBuffer, // UInt16 inPosMode = fsAtMark, SInt64 inOffset = 0); OSStatus ReadData( SInt32 &ioCount, void *inBuffer, UInt16 inPosMode = fsAtMark, SInt64 inOffset = 0); void OpenDataForkForReading(Boolean isUnicode = kTextIsUnicode); void OpenDataForkForWriting(Boolean isUnicode = kTextIsUnicode); virtual Boolean IsTwoByteUnicode() { return (mByteOrder != kByteOrderUndefined); } virtual UniChar GetByteOrderMark() { return mByteOrder; } static void InvertByteOrder(UniCharPtr uniTextPtr, UniCharCount uniTextLen); protected: UniChar mByteOrder; }; #endif //_H_CUTextFile