Method: Qt::Internal.string_table_handler

Defined in:
lib/Qt/qtruby4.rb

.string_table_handler(data, pack_str) ⇒ Object

Keeps a hash of strings against their corresponding offsets within the qt_meta_stringdata sequence of null terminated strings. Returns a proc to get an offset given a string. That proc also adds new strings to the ‘data’ array, and updates the corresponding ‘pack_str’ Array#pack template.



2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
# File 'lib/Qt/qtruby4.rb', line 2800

def Internal.string_table_handler(data, pack_str)
	hsh = {}
	offset = 0
	return lambda do |str|
		if !hsh.has_key? str
			hsh[str] = offset
			data << str
			pack_str << "a*x"
			offset += str.length + 1
		end

		return hsh[str]
	end
end