home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.3 KB | 181 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWDbgStr.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWENVDEF_H
- #include "FWEnvDef.h"
- #endif
-
- #if !defined(FWDBGSTR_H) && defined(FW_DEBUG)
- #define FWDBGSTR_H
-
- #include <stddef.h>
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- #ifdef FW_BUILD_WIN
- #include <Windows.h>
- #endif
-
- //========================================================================================
- // CLASS FW_CDebugStream
- //========================================================================================
-
- class FW_CDebugStream
- {
- public:
- typedef FW_CDebugStream& (*Manipulator)(FW_CDebugStream &);
-
- friend FW_CDebugStream& EndLine(FW_CDebugStream &);
-
- FW_CDebugStream();
- virtual ~FW_CDebugStream();
- // Destructor
-
- virtual FW_CDebugStream &Write(const void* data, size_t size) = 0;
- // Does the raw write of the data without any data separator
-
- FW_CDebugStream &WriteChunk(const void* data, size_t size);
- // Write raw data with a data separator
-
- FW_CDebugStream &operator<<(Manipulator function);
- // Execute the manipulator
-
-
- FW_CDebugStream &operator<<(const char *string);
- // Write null terminated char string
-
- FW_CDebugStream &operator<<(const signed char *string);
- // Write null terminated string
-
- FW_CDebugStream &operator<<(const unsigned char *string);
- // Write null terminated string
-
-
- FW_CDebugStream &operator<<(char c);
- // Write character
-
- FW_CDebugStream &operator<<(signed char c);
- // Write signed character
-
- FW_CDebugStream &operator<<(unsigned char c);
- // Write unsigned character
-
- FW_CDebugStream &operator<<(short n);
- // Write short
-
- FW_CDebugStream &operator<<(int n);
- // Write int
-
- FW_CDebugStream &operator<<(long n);
- // Write long
-
- FW_CDebugStream &operator<<(unsigned short n);
- // Write unsigned short
-
- FW_CDebugStream &operator<<(unsigned int n);
- // Write unsigned
-
- FW_CDebugStream &operator<<(unsigned long n);
- // Write unsigned long
-
- FW_CDebugStream &operator<<(void* p);
- // Write address in hex
-
- protected:
- FW_CDebugStream & WriteBase10Number(unsigned long n);
- // Write long in base 10
-
- FW_CDebugStream & WriteBase16Number(unsigned long n);
- // Write unsigned long in base 16
-
- private:
- FW_CDebugStream(FW_CDebugStream& debugStream);
- FW_CDebugStream& operator=(FW_CDebugStream& debugStream);
- // Don't copy instances of this class.
- };
-
-
- inline FW_CDebugStream &FW_CDebugStream::operator<<(Manipulator function)
- {
- return function(*this);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(const char *string)
- {
- return operator<<((const signed char *) string);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(const unsigned char *string)
- {
- return operator<<((const signed char *) string);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(char c)
- {
- return operator<<((signed char) c);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(unsigned char c)
- {
- return operator<<((signed char) c);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(short n)
- {
- return operator<<((long) n);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(int n)
- {
- return operator<<((long) n);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(unsigned short n)
- {
- return operator<<((unsigned long) n);
- }
-
- inline FW_CDebugStream & FW_CDebugStream::operator<<(unsigned int n)
- {
- return operator<<((unsigned long) n);
- }
-
-
- //========================================================================================
- // CLASS EndLine
- //========================================================================================
-
- FW_CDebugStream& EndLine(FW_CDebugStream &);
- // Output end of line character or characters depending on platform
-
-
- #ifdef FW_BUILD_MAC
- //========================================================================================
- // CLASS FW_CMacDebugStr
- //========================================================================================
- class FW_CMacDebugStr : public FW_CDebugStream
- {
- public:
- FW_CMacDebugStr();
- virtual ~FW_CMacDebugStr();
-
- virtual FW_CDebugStream &Write(const void *data, size_t size);
-
- private:
- void Flush();
-
- private:
- unsigned char fStr255[256];
- };
- #endif
-
- #endif
-