class Origami::XRef
Class representing a Cross-reference information.
Constants
- FIRSTFREE
- FREE
- USED
Attributes
generation[RW]
offset[RW]
state[RW]
Public Class Methods
new(offset, generation, state)
click to toggle source
Public Instance Methods
free?()
click to toggle source
Returns true if the associated object is freed.
# File lib/origami/xreftable.rb, line 92 def free? @state == FREE end
to_s()
click to toggle source
Outputs self into PDF
code.
# File lib/origami/xreftable.rb, line 99 def to_s off = @offset.to_s.rjust(10, '0') gen = @generation.to_s.rjust(5, '0') "#{off} #{gen} #{@state}" + EOL end
to_xrefstm_data(type_w, field1_w, field2_w)
click to toggle source
# File lib/origami/xreftable.rb, line 106 def to_xrefstm_data(type_w, field1_w, field2_w) type_w <<= 3 field1_w <<= 3 field2_w <<= 3 type = ((@state == FREE) ? "\000" : "\001").unpack("B#{type_w}")[0] offset = @offset.to_s(2).rjust(field1_w, '0') generation = @generation.to_s(2).rjust(field2_w, '0') [ type , offset, generation ].pack("B#{type_w}B#{field1_w}B#{field2_w}") end
used?()
click to toggle source
Returns true if the associated object is used.
# File lib/origami/xreftable.rb, line 85 def used? @state == USED end