Next / Previous / Contents / Shipman's homepage

24. class PageHeader: Page header line object

An instance of this class represents the information from a page header line. See the specification.

baseclasses.py
# - - - - -   c l a s s   P a g e H e a d e r   - - - - -

class PageHeader:
    '''Represents a new page header line.

      Exports:
        PageHeader(size, pageNo):
          [ (size is the band size or other sheet type as a string) and
            (pageNo is the page number as a string) ->
              return a new PageHeader object with those values ]
        .size:       [ as passed to constructor, read-only ]
        .pageNo:     [ as passed to constructor, read-only ]
        PageHeader.scanLine(compiler, scan):   # Static method
          [ (compiler is a BaseCompiler object) and
            (scan is a Scan object) ->
              if the line in scan is a valid page header line in 
              the context of compiler, with the scan position just
              after the PAGE_SYMBOL ->
                return a new PageHeader object representing that line
              else ->
                Log()  +:=  error message(s)
                raise SyntaxError
              In any case ->
                scan  :=  scan advanced no further than end of line ]
    '''

24.1. PageHeader.__init__(): Constructor

The constructor simply stores away its attributes.

baseclasses.py
# - - -   P a g e H e a d e r . _ _ i n i t _ _   - - -

    def __init__(self, size, pageNo):
        '''Constructor for PageHeader.
        '''
        self.size     = size
        self.pageNo   = pageNo