// $Revision: 1.2 $ // Copyright (C) 1995 Taligent, Inc. All rights reserved. #ifndef Taligent_XBM #include "XBM.h" #endif #ifndef Taligent_DECODEXBM #include "DecodeXBM.h" #endif #ifndef Taligent_PRIMITIVETYPES #include #endif #ifndef Taligent_TEXTCLASSES #include #endif TXBMConverter::TXBMConverter() { } TModifiableImage* TXBMConverter::CreateFrom( TStream& XBMStream ) { TXBMDecoder decoder(XBMStream); TModifiableImage* result = decoder.OrphanImage(); return result; } TaligentTypeExtensionMacro(TXBMConverter::TXBMConverterException) TXBMConverter::TXBMConverterException::TXBMConverterException() : TStandardException() { } TXBMConverter::TXBMConverterException::TXBMConverterException(ErrorCode code) : TStandardException(), fCode(code) { } TXBMConverter::TXBMConverterException::TXBMConverterException( const TXBMConverterException& e) : TStandardException(e), fCode(e.fCode) { } TXBMConverter::TXBMConverterException::~TXBMConverterException() { } TStream& TXBMConverter::TXBMConverterException::operator>>=(TStream &toStream) const { TStandardException::operator>>=(toStream); unsigned char code = (unsigned char) fCode; code >>= toStream; return toStream; } TStream& TXBMConverter::TXBMConverterException::operator <<=(TStream &fromStream) { TStandardException::operator<<=(fromStream); unsigned char code; code <<= fromStream; fCode = (ErrorCode)code; return fromStream; } TXBMConverter::TXBMConverterException::ErrorCode TXBMConverter::TXBMConverterException::GetErrorCode() const { return fCode; } void TXBMConverter::TXBMConverterException::GetDescription(TText& text) { const char* kDescriptions[] = { "Not a XBM data stream.", "Bad data while decoding pixels." }; text.Delete(); text.Insert(TStandardText(kDescriptions[fCode])); } void TXBMConverter::TXBMConverterException::Throw() const { throw *(TXBMConverter::TXBMConverterException*)this; }