Included Modules

Class/Module Index [+]

Quicksearch

Origami::XRefStream

Class representing a XRef Stream.

Public Class Methods

new(data = "", dictionary = {}) click to toggle source
# File lib/origami/xreftable.rb, line 337
def initialize(data = "", dictionary = {})
  super(data, dictionary)

  @xrefs = nil
end

Public Instance Methods

<<(xref) click to toggle source

Adds an XRef to this Stream.

# File lib/origami/xreftable.rb, line 366
def <<(xref)
  load! if @xrefs.nil?

  @xrefs << xref  
end
clear() click to toggle source
# File lib/origami/xreftable.rb, line 401
def clear
  self.data = ''
  @xrefs = []
  self.Index = []
end
each(&b) click to toggle source

Iterates over each XRef present in the stream.

# File lib/origami/xreftable.rb, line 375
def each(&b)
  load! if @xrefs.nil?

  @xrefs.each(&b)
end
entries() click to toggle source
# File lib/origami/xreftable.rb, line 343
def entries
  load! if @xrefs.nil?

  @xrefs
end
find(no) click to toggle source

Returns an XRef matching this object number.

# File lib/origami/xreftable.rb, line 384
def find(no)
  load! if @xrefs.nil?

  ranges = self.Index || [ 0, @xrefs.length ]

  index = 0
  (ranges.size / 2).times do |i|
    brange = ranges[i*2].to_i
    size = ranges[i*2+1].to_i
    return @xrefs[index + no - brange] if Range.new(brange, brange + size - 1) === no

    index += size
  end

  nil
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.