Back to index

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

#include <Stream.h>

Inheritance diagram for ASCII85Stream:
Inheritance graph
[legend]
Collaboration diagram for ASCII85Stream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Protected Attributes

Streamstr

Private Attributes

int c [5]
int b [4]
int index
int n
GBool eof

Detailed Description

Definition at line 395 of file Stream.h.


Constructor & Destructor Documentation

Definition at line 929 of file Stream.cc.

                                        :
    FilterStream(strA) {
  index = n = 0;
  eof = gFalse;
}

Definition at line 935 of file Stream.cc.

                              {
  delete str;
}

Member Function Documentation

Stream * Stream::addFilters ( Object dict) [inherited]

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 FilterStream::close ( ) [virtual, inherited]

Reimplemented from Stream.

Definition at line 306 of file Stream.cc.

                         {
  str->close();
}

Here is the call graph for this function:

int Stream::decRef ( ) [inline, inherited]

Definition at line 58 of file Stream.h.

{ return --ref; }
virtual BaseStream* FilterStream::getBaseStream ( ) [inline, virtual, inherited]

Implements Stream.

Definition at line 174 of file Stream.h.

{ return str->getBaseStream(); }

Here is the call graph for this function:

virtual int ASCII85Stream::getChar ( ) [inline, virtual]

Implements Stream.

Definition at line 402 of file Stream.h.

    { int ch = lookChar(); ++index; return ch; }

Here is the call graph for this function:

virtual Dict* FilterStream::getDict ( ) [inline, virtual, inherited]

Implements Stream.

Definition at line 175 of file Stream.h.

{ return str->getDict(); }

Here is the call graph for this function:

virtual StreamKind ASCII85Stream::getKind ( ) [inline, virtual]

Implements Stream.

Definition at line 400 of file Stream.h.

{ return strASCII85; }
char * Stream::getLine ( char *  buf,
int  size 
) [virtual, inherited]

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 FilterStream::getPos ( ) [inline, virtual, inherited]

Implements Stream.

Definition at line 172 of file Stream.h.

{ return str->getPos(); }

Here is the call graph for this function:

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

Reimplemented from Stream.

Definition at line 989 of file Stream.cc.

                                                             {
  GString *s;

  if (psLevel < 2) {
    return NULL;
  }
  if (!(s = str->getPSFilter(psLevel, indent))) {
    return NULL;
  }
  s->append(indent)->append("/ASCII85Decode filter\n");
  return s;
}

Here is the call graph for this function:

int Stream::getRawChar ( ) [virtual, inherited]

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 FilterStream::ignoreLength ( ) [inline, virtual, inherited]

Reimplemented from Stream.

Definition at line 176 of file Stream.h.

{ str->ignoreLength(); }

Here is the call graph for this function:

int Stream::incRef ( ) [inline, inherited]

Definition at line 57 of file Stream.h.

{ return ++ref; }
GBool ASCII85Stream::isBinary ( GBool  last = gTrue) [virtual]

Implements Stream.

Definition at line 1002 of file Stream.cc.

                                        {
  return str->isBinary(gFalse);
}

Here is the call graph for this function:

virtual GBool Stream::isEncoder ( ) [inline, virtual, inherited]

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:

Implements Stream.

Definition at line 945 of file Stream.cc.

                            {
  int k;
  Gulong t;

  if (index >= n) {
    if (eof)
      return EOF;
    index = 0;
    do {
      c[0] = str->getChar();
    } while (c[0] == '\n' || c[0] == '\r');
    if (c[0] == '~' || c[0] == EOF) {
      eof = gTrue;
      n = 0;
      return EOF;
    } else if (c[0] == 'z') {
      b[0] = b[1] = b[2] = b[3] = 0;
      n = 4;
    } else {
      for (k = 1; k < 5; ++k) {
       do {
         c[k] = str->getChar();
       } while (c[k] == '\n' || c[k] == '\r');
       if (c[k] == '~' || c[k] == EOF)
         break;
      }
      n = k - 1;
      if (k < 5 && (c[k] == '~' || c[k] == EOF)) {
       for (++k; k < 5; ++k)
         c[k] = 0x21 + 84;
       eof = gTrue;
      }
      t = 0;
      for (k = 0; k < 5; ++k)
       t = t * 85 + (c[k] - 0x21);
      for (k = 3; k >= 0; --k) {
       b[k] = (int)(t & 0xff);
       t >>= 8;
      }
    }
  }
  return b[index];
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ASCII85Stream::reset ( ) [virtual]

Implements Stream.

Definition at line 939 of file Stream.cc.

                          {
  str->reset();
  index = n = 0;
  eof = gFalse;
}

Here is the call graph for this function:

void FilterStream::setPos ( Guint  pos,
int  dir = 0 
) [virtual, inherited]

Implements Stream.

Definition at line 310 of file Stream.cc.

                                            {
  error(-1, "Internal: called setPos() on FilterStream");
}

Here is the call graph for this function:


Member Data Documentation

int ASCII85Stream::b[4] [private]

Definition at line 411 of file Stream.h.

int ASCII85Stream::c[5] [private]

Definition at line 410 of file Stream.h.

Definition at line 413 of file Stream.h.

Definition at line 412 of file Stream.h.

int ASCII85Stream::n [private]

Definition at line 412 of file Stream.h.

Stream* FilterStream::str [protected, inherited]

Definition at line 180 of file Stream.h.


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