getView method

Map<K, V> getView()

Returns an immutable view of the map.

Implementation

Map<K, V> getView() {
  final retValuePtr = calloc<COMObject>();

  try {
    final hr = ptr.ref.lpVtbl.value
            .elementAt(9)
            .cast<
                Pointer<
                    NativeFunction<
                        HRESULT Function(Pointer, Pointer<COMObject>)>>>()
            .value
            .asFunction<int Function(Pointer, Pointer<COMObject>)>()(
        ptr.ref.lpVtbl, retValuePtr);

    if (FAILED(hr)) throw WindowsException(hr);

    return IMapView<K, V>.fromRawPointer(retValuePtr,
            creator: _creator,
            enumCreator: _enumCreator,
            iterableIid: _iterableIid)
        .toMap();
  } finally {
    free(retValuePtr);
  }
}