Sha256: 4ae14fdf3b062de7abd441e55010019e303f02bcbc739e8ec18f7ae6d9979f66
Contents?: true
Size: 1.98 KB
Versions: 7
Compression:
Stored size: 1.98 KB
Contents
=begin = File docmdp.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Origami is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Origami. If not, see <http://www.gnu.org/licenses/>. =end module Origami class Null def to_docmdp_str "\000" end end class Integer def to_docmdp_str [ 1, self.value & 0xFFFFFFFF ].pack("CN") end end class Real def to_docmdp_str [ 2, self.value.round & 0xFFFFFFFF ].pack("CN") end end class Boolean def to_docmdp_str [ 3, (self.false?) ? 0 : 1 ].pack("CN") end end class Name def to_docmdp_str [ 4, self.to_s.length, self.to_s ].pack("CNA*") end end class String def to_docmdp_str [ 5, self.to_s.length, self.to_s ].pack("CNA*") end end class Dictionary def to_docmdp_str(*fields) if fields.empty? self.each_pair { |key, value| } else end end end class Array def to_docmdp_str str = [ 7, self.length ].pack("CN") self.each do |obj| str << obj.to_docmdp_str end str end end class Stream def to_docmdp_str [ 8, self.dictionary.size ].pack("CN") + self.dictionary.to_docmdp_str(:DecodeParms, :F, :FDecodeParms, :FFilter, :Filter, :Length) + [ self.rawdata.length, self.rawdata ].pack("NA*") end end end
Version data entries
7 entries across 7 versions & 1 rubygems