class GDAL::Utils::Helpers::StringList

A basic wrapper for CPLStringList (e.g. char **papszArgv).

@private @note This class is intended only to be used internally in ffi-gdal. It’s API may change.

Do not use this class directly.

Attributes

c_pointer[R]

@return [FFI::Pointer] C pointer to CPLStringList (e.g. char **papszArgv).

strings[R]

@return [Array<String>] Strings in the list.

Public Class Methods

new(strings: []) click to toggle source

@param strings [Array<String>] Strings to build the list.

# File lib/gdal/utils/helpers/string_list.rb, line 28
def initialize(strings: [])
  @strings = strings
  @c_pointer = AutoPointer.new(string_list_pointer)
end

Private Instance Methods

string_list_pointer() click to toggle source
# File lib/gdal/utils/helpers/string_list.rb, line 35
def string_list_pointer
  pointer = ::FFI::Pointer.new(FFI::Pointer::NULL)

  strings.each do |string|
    pointer = ::FFI::CPL::String.CSLAddString(pointer, string.to_s)
  end

  pointer
end