createCDataSection method

XmlCDataSection? createCDataSection(
  1. String data
)

Implementation

XmlCDataSection? createCDataSection(String data) {
  final newCDataSection = calloc<COMObject>();

  final hr = ptr.ref.vtable
          .elementAt(17)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(VTablePointer lpVtbl, IntPtr data,
                          Pointer<COMObject> newCDataSection)>>>()
          .value
          .asFunction<
              int Function(VTablePointer lpVtbl, int data,
                  Pointer<COMObject> newCDataSection)>()(
      ptr.ref.lpVtbl, data.toHString(), newCDataSection);

  if (FAILED(hr)) {
    free(newCDataSection);
    throwWindowsException(hr);
  }

  if (newCDataSection.isNull) {
    free(newCDataSection);
    return null;
  }

  return XmlCDataSection.fromPtr(newCDataSection);
}