Back to index

tetex-bin  3.0
Public Member Functions | Private Member Functions | Private Attributes
Stream Class Reference

#include <Stream.h>

Inheritance diagram for Stream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Stream ()
virtual ~Stream ()
int incRef ()
int decRef ()
virtual StreamKind getKind ()=0
virtual void reset ()=0
virtual void close ()
virtual int getChar ()=0
virtual int lookChar ()=0
virtual int getRawChar ()
virtual char * getLine (char *buf, int size)
virtual int getPos ()=0
virtual void setPos (Guint pos, int dir=0)=0
virtual GStringgetPSFilter (int psLevel, char *indent)
virtual GBool isBinary (GBool last=gTrue)=0
virtual BaseStreamgetBaseStream ()=0
virtual DictgetDict ()=0
virtual GBool isEncoder ()
StreamaddFilters (Object *dict)
virtual void ignoreLength ()

Private Member Functions

StreammakeFilter (char *name, Stream *str, Object *params)

Private Attributes

int ref

Detailed Description

Definition at line 47 of file Stream.h.


Constructor & Destructor Documentation

Definition at line 52 of file Stream.cc.

               {
  ref = 1;
}
Stream::~Stream ( ) [virtual]

Definition at line 56 of file Stream.cc.

                {
}

Member Function Documentation

Definition at line 92 of file Stream.cc.

                                       {
  Object obj, obj2;
  Object params, params2;
  Stream *str;
  int i;

  str = this;
  dict->dictLookup("Filter", &obj);
  if (obj.isNull()) {
    obj.free();
    dict->dictLookup("F", &obj);
  }
  dict->dictLookup("DecodeParms", &params);
  if (params.isNull()) {
    params.free();
    dict->dictLookup("DP", &params);
  }
  if (obj.isName()) {
    str = makeFilter(obj.getName(), str, &params);
  } else if (obj.isArray()) {
    for (i = 0; i < obj.arrayGetLength(); ++i) {
      obj.arrayGet(i, &obj2);
      if (params.isArray())
       params.arrayGet(i, &params2);
      else
       params2.initNull();
      if (obj2.isName()) {
       str = makeFilter(obj2.getName(), str, &params2);
      } else {
       error(getPos(), "Bad filter name");
       str = new EOFStream(str);
      }
      obj2.free();
      params2.free();
    }
  } else if (!obj.isNull()) {
    error(getPos(), "Bad 'Filter' attribute in stream");
  }
  obj.free();
  params.free();

  return str;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Stream::close ( ) [virtual]

Reimplemented in MemStream, FileStream, and FilterStream.

Definition at line 59 of file Stream.cc.

                   {
}

Here is the caller graph for this function:

int Stream::decRef ( ) [inline]

Definition at line 58 of file Stream.h.

{ return --ref; }
virtual BaseStream* Stream::getBaseStream ( ) [pure virtual]

Implemented in FilterStream, and BaseStream.

Here is the caller graph for this function:

virtual int Stream::getChar ( ) [pure virtual]
virtual Dict* Stream::getDict ( ) [pure virtual]

Implemented in FilterStream, and BaseStream.

Here is the caller graph for this function:

virtual StreamKind Stream::getKind ( ) [pure virtual]
char * Stream::getLine ( char *  buf,
int  size 
) [virtual]

Definition at line 67 of file Stream.cc.

                                         {
  int i;
  int c;

  if (lookChar() == EOF)
    return NULL;
  for (i = 0; i < size - 1; ++i) {
    c = getChar();
    if (c == EOF || c == '\n')
      break;
    if (c == '\r') {
      if ((c = lookChar()) == '\n')
       getChar();
      break;
    }
    buf[i] = c;
  }
  buf[i] = '\0';
  return buf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int Stream::getPos ( ) [pure virtual]

Implemented in EmbedStream, MemStream, FileStream, and FilterStream.

Here is the caller graph for this function:

GString * Stream::getPSFilter ( int  psLevel,
char *  indent 
) [virtual]

Reimplemented in RunLengthEncoder, ASCII85Encoder, ASCIIHexEncoder, FixedLengthEncoder, EOFStream, FlateStream, DCTStream, CCITTFaxStream, RunLengthStream, LZWStream, ASCII85Stream, ASCIIHexStream, JPXStream, and JBIG2Stream.

Definition at line 88 of file Stream.cc.

                                                      {
  return new GString();
}

Here is the caller graph for this function:

int Stream::getRawChar ( ) [virtual]

Reimplemented in FlateStream, and LZWStream.

Definition at line 62 of file Stream.cc.

                       {
  error(-1, "Internal: called getRawChar() on non-predictor stream");
  return EOF;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Stream::ignoreLength ( ) [inline, virtual]

Reimplemented in FileStream, and FilterStream.

Definition at line 112 of file Stream.h.

{}

Here is the caller graph for this function:

int Stream::incRef ( ) [inline]

Definition at line 57 of file Stream.h.

{ return ++ref; }
virtual GBool Stream::isBinary ( GBool  last = gTrue) [pure virtual]
virtual GBool Stream::isEncoder ( ) [inline, virtual]

Reimplemented in RunLengthEncoder, ASCII85Encoder, ASCIIHexEncoder, and FixedLengthEncoder.

Definition at line 103 of file Stream.h.

{ return gFalse; }

Here is the caller graph for this function:

virtual int Stream::lookChar ( ) [pure virtual]
Stream * Stream::makeFilter ( char *  name,
Stream str,
Object params 
) [private]

Definition at line 136 of file Stream.cc.

                                                                  {
  int pred;                 // parameters
  int colors;
  int bits;
  int early;
  int encoding;
  GBool endOfLine, byteAlign, endOfBlock, black;
  int columns, rows;
  Object globals, obj;

  if (!strcmp(name, "ASCIIHexDecode") || !strcmp(name, "AHx")) {
    str = new ASCIIHexStream(str);
  } else if (!strcmp(name, "ASCII85Decode") || !strcmp(name, "A85")) {
    str = new ASCII85Stream(str);
  } else if (!strcmp(name, "LZWDecode") || !strcmp(name, "LZW")) {
    pred = 1;
    columns = 1;
    colors = 1;
    bits = 8;
    early = 1;
    if (params->isDict()) {
      params->dictLookup("Predictor", &obj);
      if (obj.isInt())
       pred = obj.getInt();
      obj.free();
      params->dictLookup("Columns", &obj);
      if (obj.isInt())
       columns = obj.getInt();
      obj.free();
      params->dictLookup("Colors", &obj);
      if (obj.isInt())
       colors = obj.getInt();
      obj.free();
      params->dictLookup("BitsPerComponent", &obj);
      if (obj.isInt())
       bits = obj.getInt();
      obj.free();
      params->dictLookup("EarlyChange", &obj);
      if (obj.isInt())
       early = obj.getInt();
      obj.free();
    }
    str = new LZWStream(str, pred, columns, colors, bits, early);
  } else if (!strcmp(name, "RunLengthDecode") || !strcmp(name, "RL")) {
    str = new RunLengthStream(str);
  } else if (!strcmp(name, "CCITTFaxDecode") || !strcmp(name, "CCF")) {
    encoding = 0;
    endOfLine = gFalse;
    byteAlign = gFalse;
    columns = 1728;
    rows = 0;
    endOfBlock = gTrue;
    black = gFalse;
    if (params->isDict()) {
      params->dictLookup("K", &obj);
      if (obj.isInt()) {
       encoding = obj.getInt();
      }
      obj.free();
      params->dictLookup("EndOfLine", &obj);
      if (obj.isBool()) {
       endOfLine = obj.getBool();
      }
      obj.free();
      params->dictLookup("EncodedByteAlign", &obj);
      if (obj.isBool()) {
       byteAlign = obj.getBool();
      }
      obj.free();
      params->dictLookup("Columns", &obj);
      if (obj.isInt()) {
       columns = obj.getInt();
      }
      obj.free();
      params->dictLookup("Rows", &obj);
      if (obj.isInt()) {
       rows = obj.getInt();
      }
      obj.free();
      params->dictLookup("EndOfBlock", &obj);
      if (obj.isBool()) {
       endOfBlock = obj.getBool();
      }
      obj.free();
      params->dictLookup("BlackIs1", &obj);
      if (obj.isBool()) {
       black = obj.getBool();
      }
      obj.free();
    }
    str = new CCITTFaxStream(str, encoding, endOfLine, byteAlign,
                          columns, rows, endOfBlock, black);
  } else if (!strcmp(name, "DCTDecode") || !strcmp(name, "DCT")) {
    str = new DCTStream(str);
  } else if (!strcmp(name, "FlateDecode") || !strcmp(name, "Fl")) {
    pred = 1;
    columns = 1;
    colors = 1;
    bits = 8;
    if (params->isDict()) {
      params->dictLookup("Predictor", &obj);
      if (obj.isInt())
       pred = obj.getInt();
      obj.free();
      params->dictLookup("Columns", &obj);
      if (obj.isInt())
       columns = obj.getInt();
      obj.free();
      params->dictLookup("Colors", &obj);
      if (obj.isInt())
       colors = obj.getInt();
      obj.free();
      params->dictLookup("BitsPerComponent", &obj);
      if (obj.isInt())
       bits = obj.getInt();
      obj.free();
    }
    str = new FlateStream(str, pred, columns, colors, bits);
  } else if (!strcmp(name, "JBIG2Decode")) {
    if (params->isDict()) {
      params->dictLookup("JBIG2Globals", &globals);
    }
    str = new JBIG2Stream(str, &globals);
    globals.free();
  } else if (!strcmp(name, "JPXDecode")) {
    str = new JPXStream(str);
  } else {
    error(getPos(), "Unknown filter '%s'", name);
    str = new EOFStream(str);
  }
  return str;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void Stream::reset ( ) [pure virtual]
virtual void Stream::setPos ( Guint  pos,
int  dir = 0 
) [pure virtual]

Member Data Documentation

int Stream::ref [private]

Definition at line 118 of file Stream.h.


The documentation for this class was generated from the following files: