# CContentStream

Content stream can consist of one or more . It is responsible for everything on a page. If anything visible is changed the content stream must be changed. Content stream is a stream processed sequentially. Page can consist of one or more content streams and these streams must be concatenated before reading (objects can be splitted between two content streams). Content stream consists of operators and their operands. Each operator updates graphical state.

## Observing ccontentstream

Generally, changing anything visible on a page means changing something in underlying content stream. Because operators are processed sequentially changing of one operator/operand may affect many following operators (e.g. their bounding boxes). Page needs to know if a content stream is changed because it must reparse operators. CContentStream implements observer subject interface so for example cpage (as content stream maintainer) can be informed when it is changed.

## Changing ccontentstream

Content stream can be changed in two ways. Either by ccontentstream methods or by requesting raw operator and changing its operands. The third way is to add/delete whole stream. This problem is solved by Observers .

## Storing pdf operators

Operators are processed sequentially and there are many situations when only some types of operators are needed. Clear solution is to use the . With this patter we can process operators one by one. If we need specific iterators we just create another child of basic iterator. There are be simple and composite operators. Operators form a tree-like structure. This is more readable than a list of all operators. So we implement another tree-like queue. Only the first level of operators is stored in ccontentstream. Each composite operator stores its children. This is an example of . Simple and composite operators are accessed uniformly.

Operator queues

## Changing pdf operators

Deleting and inserting an operator is not easy because it is stored in two queues. We have information only about one queue (that one which was used to get the operator) so we need to find out the position in the second queue and change it adequately.