Generate new bindings

This commit is contained in:
Jeremy Pritts committed 2023-12-23 17:12:03 -05:00
1 parent caf98b92f7
commit ca2d7f7147
3 files changed
+427 -274

No files matched your search

@@ -2,5 +2,5 @@
#include <new>
nfdpathsetenum_t& (nfdpathsetenum_t::*_0)(nfdpathsetenum_t&&) = &nfdpathsetenum_t::operator=;
nfdnfilteritem_t& (nfdnfilteritem_t::*_1)(nfdnfilteritem_t&&) = &nfdnfilteritem_t::operator=;
nfdu8filteritem_t& (nfdu8filteritem_t::*_2)(nfdu8filteritem_t&&) = &nfdu8filteritem_t::operator=;
nfdu8filteritem_t& (nfdu8filteritem_t::*_1)(nfdu8filteritem_t&&) = &nfdu8filteritem_t::operator=;
nfdnfilteritem_t& (nfdnfilteritem_t::*_2)(nfdnfilteritem_t&&) = &nfdnfilteritem_t::operator=;
+408 -272
View File
@@ -16,8 +16,11 @@ namespace NativeFileDialogs.AutoGen
{
public enum NfdresultT
{
/// <summary>Programmatic error</summary>
NFD_ERROR = 0,
/// <summary>User pressed okay, or successful return</summary>
NFD_OKAY = 1,
/// <summary>User pressed cancel</summary>
NFD_CANCEL = 2
}
@@ -142,169 +145,6 @@ namespace NativeFileDialogs.AutoGen
}
}
public unsafe partial class NfdnfilteritemT : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
{
internal __IntPtr name;
internal __IntPtr spec;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "??0nfdnfilteritem_t@@QEAA@AEBU0@@Z", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr cctor(__IntPtr __instance, __IntPtr _0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdnfilteritemT> NativeToManagedMap =
new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdnfilteritemT>();
internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.NfdnfilteritemT managed)
{
NativeToManagedMap[native] = managed;
}
internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.NfdnfilteritemT managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
}
private bool __name_OwnsNativeMemory = false;
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
internal static NfdnfilteritemT __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
return new NfdnfilteritemT(native.ToPointer(), skipVTables);
}
internal static NfdnfilteritemT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (__TryGetNativeToManagedMapping(native, out var managed))
return (NfdnfilteritemT)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
internal static NfdnfilteritemT __CreateInstance(__Internal native, bool skipVTables = false)
{
return new NfdnfilteritemT(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private NfdnfilteritemT(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
protected NfdnfilteritemT(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public NfdnfilteritemT()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
public NfdnfilteritemT(global::NativeFileDialogs.AutoGen.NfdnfilteritemT _0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
*((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) _0.__Instance);
if (_0.__name_OwnsNativeMemory)
this.Name = _0.Name;
if (_0.__spec_OwnsNativeMemory)
this.Spec = _0.Spec;
}
public void Dispose()
{
Dispose(disposing: true, callNativeDtor : __ownsNativeInstance );
}
partial void DisposePartial(bool disposing);
internal protected virtual void Dispose(bool disposing, bool callNativeDtor )
{
if (__Instance == IntPtr.Zero)
return;
NativeToManagedMap.TryRemove(__Instance, out _);
DisposePartial(disposing);
if (__name_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->name);
if (__spec_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->spec);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public string Name
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.Unicode, ((__Internal*)__Instance)->name);
}
set
{
if (__name_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->name);
__name_OwnsNativeMemory = true;
if (value == null)
{
((__Internal*)__Instance)->name = global::System.IntPtr.Zero;
return;
}
var __bytePtr0 = Marshal.StringToHGlobalUni(value);
((__Internal*)__Instance)->name = (__IntPtr) __bytePtr0;
}
}
public string Spec
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.Unicode, ((__Internal*)__Instance)->spec);
}
set
{
if (__spec_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->spec);
__spec_OwnsNativeMemory = true;
if (value == null)
{
((__Internal*)__Instance)->spec = global::System.IntPtr.Zero;
return;
}
var __bytePtr0 = Marshal.StringToHGlobalUni(value);
((__Internal*)__Instance)->spec = (__IntPtr) __bytePtr0;
}
}
}
public unsafe partial class Nfdu8filteritemT : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
@@ -474,6 +314,170 @@ namespace NativeFileDialogs.AutoGen
}
}
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public unsafe partial class NfdnfilteritemT : IDisposable
{
[StructLayout(LayoutKind.Sequential, Size = 16)]
public partial struct __Internal
{
internal __IntPtr name;
internal __IntPtr spec;
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "??0nfdnfilteritem_t@@QEAA@AEBU0@@Z", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr cctor(__IntPtr __instance, __IntPtr _0);
}
public __IntPtr __Instance { get; protected set; }
internal static readonly new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdnfilteritemT> NativeToManagedMap =
new global::System.Collections.Concurrent.ConcurrentDictionary<IntPtr, global::NativeFileDialogs.AutoGen.NfdnfilteritemT>();
internal static void __RecordNativeToManagedMapping(IntPtr native, global::NativeFileDialogs.AutoGen.NfdnfilteritemT managed)
{
NativeToManagedMap[native] = managed;
}
internal static bool __TryGetNativeToManagedMapping(IntPtr native, out global::NativeFileDialogs.AutoGen.NfdnfilteritemT managed)
{
return NativeToManagedMap.TryGetValue(native, out managed);
}
private bool __name_OwnsNativeMemory = false;
private bool __spec_OwnsNativeMemory = false;
protected bool __ownsNativeInstance;
internal static NfdnfilteritemT __CreateInstance(__IntPtr native, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
return new NfdnfilteritemT(native.ToPointer(), skipVTables);
}
internal static NfdnfilteritemT __GetOrCreateInstance(__IntPtr native, bool saveInstance = false, bool skipVTables = false)
{
if (native == __IntPtr.Zero)
return null;
if (__TryGetNativeToManagedMapping(native, out var managed))
return (NfdnfilteritemT)managed;
var result = __CreateInstance(native, skipVTables);
if (saveInstance)
__RecordNativeToManagedMapping(native, result);
return result;
}
internal static NfdnfilteritemT __CreateInstance(__Internal native, bool skipVTables = false)
{
return new NfdnfilteritemT(native, skipVTables);
}
private static void* __CopyValue(__Internal native)
{
var ret = Marshal.AllocHGlobal(sizeof(__Internal));
*(__Internal*) ret = native;
return ret.ToPointer();
}
private NfdnfilteritemT(__Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
protected NfdnfilteritemT(void* native, bool skipVTables = false)
{
if (native == null)
return;
__Instance = new __IntPtr(native);
}
public NfdnfilteritemT()
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
}
public NfdnfilteritemT(global::NativeFileDialogs.AutoGen.NfdnfilteritemT _0)
{
__Instance = Marshal.AllocHGlobal(sizeof(global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal));
__ownsNativeInstance = true;
__RecordNativeToManagedMapping(__Instance, this);
*((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) __Instance) = *((global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal*) _0.__Instance);
if (_0.__name_OwnsNativeMemory)
this.Name = _0.Name;
if (_0.__spec_OwnsNativeMemory)
this.Spec = _0.Spec;
}
public void Dispose()
{
Dispose(disposing: true, callNativeDtor : __ownsNativeInstance );
}
partial void DisposePartial(bool disposing);
internal protected virtual void Dispose(bool disposing, bool callNativeDtor )
{
if (__Instance == IntPtr.Zero)
return;
NativeToManagedMap.TryRemove(__Instance, out _);
DisposePartial(disposing);
if (__name_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->name);
if (__spec_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->spec);
if (__ownsNativeInstance)
Marshal.FreeHGlobal(__Instance);
__Instance = IntPtr.Zero;
}
public string Name
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.Unicode, ((__Internal*)__Instance)->name);
}
set
{
if (__name_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->name);
__name_OwnsNativeMemory = true;
if (value == null)
{
((__Internal*)__Instance)->name = global::System.IntPtr.Zero;
return;
}
var __bytePtr0 = Marshal.StringToHGlobalUni(value);
((__Internal*)__Instance)->name = (__IntPtr) __bytePtr0;
}
}
public string Spec
{
get
{
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.Unicode, ((__Internal*)__Instance)->spec);
}
set
{
if (__spec_OwnsNativeMemory)
Marshal.FreeHGlobal(((__Internal*)__Instance)->spec);
__spec_OwnsNativeMemory = true;
if (value == null)
{
((__Internal*)__Instance)->spec = global::System.IntPtr.Zero;
return;
}
var __bytePtr0 = Marshal.StringToHGlobalUni(value);
((__Internal*)__Instance)->spec = (__IntPtr) __bytePtr0;
}
}
}
public unsafe partial class nfd
{
public partial struct __Internal
@@ -481,6 +485,9 @@ namespace NativeFileDialogs.AutoGen
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_FreePathN(char* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_FreePathU8(sbyte* filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_Init", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_Init();
@@ -490,15 +497,27 @@ namespace NativeFileDialogs.AutoGen
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogN(char** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogMultipleN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleN(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogMultipleU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleU8(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_SaveDialogN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogN(char** outPath, global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath, [MarshalAs(UnmanagedType.LPWStr)] string defaultName);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_SaveDialogU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint filterCount, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultName);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PickFolderN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderN(char** outPath, [MarshalAs(UnmanagedType.LPWStr)] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PickFolderU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderU8(sbyte** outPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_GetError", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr NFD_GetError();
@@ -511,6 +530,15 @@ namespace NativeFileDialogs.AutoGen
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetPathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetPathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreePathN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFreePathN([MarshalAs(UnmanagedType.LPWStr)] string filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFreePathU8([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string filePath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetEnum", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetEnum(__IntPtr pathSet, __IntPtr outEnumerator);
@@ -520,47 +548,52 @@ namespace NativeFileDialogs.AutoGen
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_EnumNextN", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextN(__IntPtr enumerator, char** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_Free", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFree(__IntPtr pathSet);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_FreePathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_FreePathU8(sbyte* outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_OpenDialogMultipleU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleU8(__IntPtr* outPaths, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_SaveDialogU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogU8(sbyte** outPath, global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* filterList, uint count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultName);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PickFolderU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderU8(sbyte** outPath, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string defaultPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_GetPathU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_EnumNextU8", CallingConvention = __CallingConvention.Cdecl)]
internal static extern global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextU8(__IntPtr enumerator, sbyte** outPath);
[SuppressUnmanagedCodeSecurity, DllImport("nfd", EntryPoint = "NFD_PathSet_Free", CallingConvention = __CallingConvention.Cdecl)]
internal static extern void NFD_PathSetFree(__IntPtr pathSet);
}
/// <summary>Free a file path that was returned by the dialogs.</summary>
/// <remarks>Note: use NFD_PathSet_FreePathN() to free path from pathset instead of this function.</remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void NFD_FreePathN(char* filePath)
{
__Internal.NFD_FreePathN(filePath);
}
/// <summary>Free a file path that was returned by the dialogs.</summary>
/// <remarks>Note: use NFD_PathSet_FreePathU8() to free path from pathset instead of this function.</remarks>
public static void NFD_FreePathU8(sbyte* filePath)
{
__Internal.NFD_FreePathU8(filePath);
}
/// <summary>
/// <para>Initialize NFD. Call this for every thread that might use NFD, before calling any other NFD</para>
/// <para>functions on that thread.</para>
/// </summary>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_Init()
{
var ___ret = __Internal.NFD_Init();
return ___ret;
}
/// <summary>Call this to de-initialize NFD, if NFD_Init returned NFD_OKAY.</summary>
public static void NFD_Quit()
{
__Internal.NFD_Quit();
}
/// <summary>Single file open dialog</summary>
/// <param name="filterCount">If zero, filterList is ignored (you can use null).</param>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It's the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns</para>
/// <para>NFD_OKAY.</para>
/// </remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogN(char** outPath, Span<global::NativeFileDialogs.AutoGen.NfdnfilteritemT> filterList, uint filterCount, string defaultPath)
{
Span<global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal> __filterList;
@@ -583,6 +616,43 @@ namespace NativeFileDialogs.AutoGen
}
}
/// <summary>Single file open dialog</summary>
/// <param name="filterCount">If zero, filterList is ignored (you can use null).</param>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function</para>
/// <para>returns NFD_OKAY.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogU8(sbyte** outPath, Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT> filterList, uint filterCount, string defaultPath)
{
Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal> __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.NFD_OpenDialogU8(outPath, __arg1, filterCount, defaultPath);
return ___ret;
}
}
/// <summary>Multiple file open dialog</summary>
/// <param name="filterCount">If zero, filterList is ignored (you can use null).</param>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeN() if this function</para>
/// <para>returns NFD_OKAY.</para>
/// </remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleN(__IntPtr* outPaths, Span<global::NativeFileDialogs.AutoGen.NfdnfilteritemT> filterList, uint filterCount, string defaultPath)
{
Span<global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal> __filterList;
@@ -605,6 +675,43 @@ namespace NativeFileDialogs.AutoGen
}
}
/// <summary>Multiple file open dialog</summary>
/// <param name="filterCount">If zero, filterList is ignored (you can use null).</param>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeU8() if this function</para>
/// <para>returns NFD_OKAY.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleU8(__IntPtr* outPaths, Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT> filterList, uint filterCount, string defaultPath)
{
Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal> __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.NFD_OpenDialogMultipleU8(outPaths, __arg1, filterCount, defaultPath);
return ___ret;
}
}
/// <summary>Save dialog</summary>
/// <param name="filterCount">If zero, filterList is ignored (you can use null).</param>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns</para>
/// <para>NFD_OKAY.</para>
/// </remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogN(char** outPath, Span<global::NativeFileDialogs.AutoGen.NfdnfilteritemT> filterList, uint filterCount, string defaultPath, string defaultName)
{
Span<global::NativeFileDialogs.AutoGen.NfdnfilteritemT.__Internal> __filterList;
@@ -627,23 +734,85 @@ namespace NativeFileDialogs.AutoGen
}
}
/// <summary>Save dialog</summary>
/// <param name="filterCount">If zero, filterList is ignored (you can use null).</param>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function</para>
/// <para>returns NFD_OKAY.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogU8(sbyte** outPath, Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT> filterList, uint filterCount, string defaultPath, string defaultName)
{
Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal> __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.NFD_SaveDialogU8(outPath, __arg1, filterCount, defaultPath, defaultName);
return ___ret;
}
}
/// <summary>Select folder dialog</summary>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns</para>
/// <para>NFD_OKAY.</para>
/// </remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderN(char** outPath, string defaultPath)
{
var ___ret = __Internal.NFD_PickFolderN(outPath, defaultPath);
return ___ret;
}
/// <summary>Select folder dialog</summary>
/// <param name="defaultPath">If null, the operating system will decide.</param>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function</para>
/// <para>returns NFD_OKAY.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderU8(sbyte** outPath, string defaultPath)
{
var ___ret = __Internal.NFD_PickFolderU8(outPath, defaultPath);
return ___ret;
}
/// <summary>Get the last error</summary>
/// <returns>The last error that was set, or null if there is no error.</returns>
/// <remarks>
/// <para>This is set when a function returns NFD_ERROR.</para>
/// <para>The memory is owned by NFD and should not be freed by user code.</para>
/// <para>This is *always* ASCII printable characters, so it can be interpreted as UTF-8 without any</para>
/// <para>conversion.</para>
/// </remarks>
public static string NFD_GetError()
{
var ___ret = __Internal.NFD_GetError();
return CppSharp.Runtime.MarshalUtil.GetString(global::System.Text.Encoding.UTF8, ___ret);
}
/// <summary>Clear the error.</summary>
public static void NFD_ClearError()
{
__Internal.NFD_ClearError();
}
/// <summary>Get the number of entries stored in pathSet.</summary>
/// <remarks>
/// <para>Note: some paths might be invalid (NFD_ERROR will be returned by NFD_PathSet_GetPath),</para>
/// <para>so we might not actually have this number of usable paths.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetCount(__IntPtr pathSet, ref uint count)
{
fixed (uint* __count1 = &count)
@@ -654,12 +823,47 @@ namespace NativeFileDialogs.AutoGen
}
}
/// <summary>Get the UTF-8 path at offset index.</summary>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_PathSet_FreePathN() if this function</para>
/// <para>returns NFD_OKAY.</para>
/// </remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathN(__IntPtr pathSet, uint index, char** outPath)
{
var ___ret = __Internal.NFD_PathSetGetPathN(pathSet, index, outPath);
return ___ret;
}
/// <summary>Get the native path at offset index.</summary>
/// <remarks>
/// <para>It is the caller's responsibility to free `outPath` via NFD_PathSet_FreePathU8() if this</para>
/// <para>function returns NFD_OKAY.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath)
{
var ___ret = __Internal.NFD_PathSetGetPathU8(pathSet, index, outPath);
return ___ret;
}
/// <summary>Free the path gotten by NFD_PathSet_GetPathN().</summary>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void NFD_PathSetFreePathN(string filePath)
{
__Internal.NFD_PathSetFreePathN(filePath);
}
/// <summary>Free the path gotten by NFD_PathSet_GetPathU8().</summary>
public static void NFD_PathSetFreePathU8(string filePath)
{
__Internal.NFD_PathSetFreePathU8(filePath);
}
/// <summary>Gets an enumerator of the path set.</summary>
/// <remarks>
/// <para>It is the caller's responsibility to free `enumerator` via NFD_PathSet_FreeEnum()</para>
/// <para>if this function returns NFD_OKAY, and it should be freed before freeing the pathset.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetEnum(__IntPtr pathSet, global::NativeFileDialogs.AutoGen.NfdpathsetenumT outEnumerator)
{
var __arg1 = outEnumerator is null ? __IntPtr.Zero : outEnumerator.__Instance;
@@ -667,12 +871,20 @@ namespace NativeFileDialogs.AutoGen
return ___ret;
}
/// <summary>Frees an enumerator of the path set.</summary>
public static void NFD_PathSetFreeEnum(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
__Internal.NFD_PathSetFreeEnum(__arg0);
}
/// <summary>Gets the next item from the path set enumerator.</summary>
/// <remarks>
/// <para>If there are no more items, then *outPaths will be set to null.</para>
/// <para>It is the caller's responsibility to free `*outPath` via NFD_PathSet_FreePathN()</para>
/// <para>if this function returns NFD_OKAY and `*outPath` is not null.</para>
/// </remarks>
[global::System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextN(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator, char** outPath)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
@@ -680,99 +892,23 @@ namespace NativeFileDialogs.AutoGen
return ___ret;
}
public static void NFD_PathSetFree(__IntPtr pathSet)
{
__Internal.NFD_PathSetFree(pathSet);
}
public static void NFD_FreePathU8(sbyte* outPath)
{
__Internal.NFD_FreePathU8(outPath);
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogU8(sbyte** outPath, Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT> filterList, uint count, string defaultPath)
{
Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal> __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.NFD_OpenDialogU8(outPath, __arg1, count, defaultPath);
return ___ret;
}
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_OpenDialogMultipleU8(__IntPtr* outPaths, Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT> filterList, uint count, string defaultPath)
{
Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal> __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.NFD_OpenDialogMultipleU8(outPaths, __arg1, count, defaultPath);
return ___ret;
}
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_SaveDialogU8(sbyte** outPath, Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT> filterList, uint count, string defaultPath, string defaultName)
{
Span<global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal> __filterList;
if (filterList == null)
__filterList = null;
else
{
__filterList = new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal[filterList.Length];
for (int i = 0; i < __filterList.Length; i++)
{
var __element = filterList[i];
__filterList[i] = __element is null ? new global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal() : *(global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal*) __element.__Instance;
}
}
fixed (global::NativeFileDialogs.AutoGen.Nfdu8filteritemT.__Internal* ____filterList1 = &MemoryMarshal.GetReference(__filterList))
{
var __arg1 = ____filterList1;
var ___ret = __Internal.NFD_SaveDialogU8(outPath, __arg1, count, defaultPath, defaultName);
return ___ret;
}
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PickFolderU8(sbyte** outPath, string defaultPath)
{
var ___ret = __Internal.NFD_PickFolderU8(outPath, defaultPath);
return ___ret;
}
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetGetPathU8(__IntPtr pathSet, uint index, sbyte** outPath)
{
var ___ret = __Internal.NFD_PathSetGetPathU8(pathSet, index, outPath);
return ___ret;
}
/// <summary>Gets the next item from the path set enumerator.</summary>
/// <remarks>
/// <para>If there are no more items, then *outPaths will be set to null.</para>
/// <para>It is the caller's responsibility to free `*outPath` via NFD_PathSet_FreePathU8()</para>
/// <para>if this function returns NFD_OKAY and `*outPath` is not null.</para>
/// </remarks>
public static global::NativeFileDialogs.AutoGen.NfdresultT NFD_PathSetEnumNextU8(global::NativeFileDialogs.AutoGen.NfdpathsetenumT enumerator, sbyte** outPath)
{
var __arg0 = enumerator is null ? __IntPtr.Zero : enumerator.__Instance;
var ___ret = __Internal.NFD_PathSetEnumNextU8(__arg0, outPath);
return ___ret;
}
/// <summary>Free the pathSet</summary>
public static void NFD_PathSetFree(__IntPtr pathSet)
{
__Internal.NFD_PathSetFree(pathSet);
}
}
}
@@ -6,7 +6,10 @@ using CppSharp;
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Passes;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Versioning;
namespace NativeFileDialogs.CppSharpGenerator;
@@ -47,5 +50,19 @@ public class NativeFileDialogsLibrary : ILibrary
public void Postprocess(Driver driver, ASTContext ctx)
{
foreach (var function in ctx.TranslationUnits.SelectMany(t => t.Functions).Where(f => f.Name.EndsWith('N')))
{
AddWindowsOnlyAttribute(function);
}
AddWindowsOnlyAttribute(ctx.FindClass("NfdnfilteritemT").First());
}
public void GenerateCode(Driver driver, List<GeneratorOutput> outputs)
{
}
private static void AddWindowsOnlyAttribute(Declaration declaration)
{
declaration.Attributes.Add(new Attribute() { Type = typeof(SupportedOSPlatformAttribute), Value = "\"windows\"" });
}
}