Module: Qt::ObjectListCodec
- Defined in:
- lib/qt/object_list_codec.rb
Overview
Decodes QObjectList bridge payloads into canonical Ruby wrappers.
Class Method Summary collapse
Class Method Details
.decode(payload, expected_qt_class = 'QObject') ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/qt/object_list_codec.rb', line 10 def decode(payload, expected_qt_class = 'QObject') raw = Qt::StringCodec.from_qt_text(payload.to_s) return [] if raw.empty? JSON.parse(raw).filter_map do |address| next if address.nil? || address.to_s.empty? Qt::ObjectWrapper.wrap(FFI::Pointer.new(Integer(address, 10)), expected_qt_class) end rescue JSON::ParserError, ArgumentError [] end |