NativeExportDC Class Reference

This class makes use of the base class for almost everything. Its real purpose is just to overide the Binary and Bitmap areas of the DC. In EPSExportDC these are converted to Hex strings and here they are output directly as binary... More...

#include <nativeps.h>

Inheritance diagram for NativeExportDC:

EPSExportDC ExportDC KernelDC CCDummyDC CCDC ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 NativeExportDC (Filter *)
 Constructor for the NativeExportDC. This does nothing, except call the base class constructor.
virtual INT32 OutputRawBinary (BYTE *Data, UINT32 Length, UINT32 Alignment=1)
 Outputs a sequence of bytes as raw data.

Detailed Description

This class makes use of the base class for almost everything. Its real purpose is just to overide the Binary and Bitmap areas of the DC. In EPSExportDC these are converted to Hex strings and here they are output directly as binary...

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
See also:
EPSExportDC

Definition at line 275 of file nativeps.h.


Constructor & Destructor Documentation

NativeExportDC::NativeExportDC Filter pFilter  ) 
 

Constructor for the NativeExportDC. This does nothing, except call the base class constructor.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pFilter [INPUTS]

Definition at line 2643 of file nativeps.cpp.

02643                                               : EPSExportDC(pFilter)
02644 {
02645 }


Member Function Documentation

INT32 NativeExportDC::OutputRawBinary BYTE *  Data,
UINT32  Length,
UINT32  Alignment = 1
[virtual]
 

Outputs a sequence of bytes as raw data.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
Data - pointer to the data to output. [INPUTS] Length - the number of bytes to output. Alignment - the byte alignment to use - it will pad the end of the data with 0 bytes if Length is not divisible by this parameter. Hence use 1 for no padding.
Returns:
The number of bytes output to the file, in terms of the source data, not in terms of the number of ASCII characters used to represent them. -1 => error occured while writing => ERROR1

Errors: Disk/file error => ERROR1

Reimplemented from KernelDC.

Definition at line 2668 of file nativeps.cpp.

02669 {
02670     // Param to note how many bytes we are writing out to the file
02671     INT32 nBytes = 0;
02672 
02673     // Start off with a blank line
02674     if (!OutputNewLine())
02675         // Error encountered
02676         return -1;
02677 
02678     // Set the mode to binary
02679     //ExportFile.setMode(filebuf::binary);
02680 
02681     // Output a character to mark the begining of the binary section
02682     static TCHAR Begin = _T('>');
02683     if (!OutputTCHARAsChar(&Begin, 1))
02684         // Error
02685         return -1;
02686 
02687     // Output the line of binary data
02688     if (!OutputDirect(Data, Length))
02689     {
02690         // Error
02691         return -1;
02692     }
02693     
02694     // We saved out 'Length' bytes there
02695     nBytes += Length;
02696 
02697     // Work out the padding needed
02698     ENSURE(Alignment != 0, "Bad alignment in OutputRawBinary!");
02699     UINT32 Padding = Alignment - (Length % Alignment);
02700     if (Padding == Alignment)
02701         Padding = 0;
02702 
02703     if (Padding > 0)
02704     {
02705         // Put the string  into a Buffer
02706         TCHAR Buffer[2];
02707         Buffer[0] = 0;
02708         Buffer[1] = 0;
02709 
02710         // Output it however many times we need to
02711         while (Padding > 0)
02712         {
02713             if (OutputTCHARAsChar(Buffer, 1))
02714                 // Error
02715                 return -1;
02716 
02717             nBytes++;
02718             Padding--;
02719         }
02720     }
02721 
02722     //output an end marker
02723     static TCHAR End = _T('<');
02724     if (!OutputTCHARAsChar(&End, 1))
02725         // Error
02726         return -1;
02727         
02728     // Set the mode to binary
02729     //ExportFile.setMode(filebuf::text);
02730 
02731     // All done
02732     return nBytes;
02733 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:26 2007 for Camelot by  doxygen 1.4.4