They are not actually runtime classes but sealed classes. The current widl doesn't understand this keyword so we pretend they are runtime classes. It generates the same code.
The IStorageFile interface is described at [1]. The IStorageFileStatics is the interface to use to access the static methods of StorageFile [2], to use by creating an instance of "Windows.Storage.StorageFile" with RoGetActivationFactory(). [1] https://docs.microsoft.com/en-us/uwp/api/windows.storage.istoragefile [2] https://docs.microsoft.com/en-us/uwp/api/windows.storage.storagefile --- mingw-w64-headers/include/windows.storage.idl | 96 +++++++++++++++++-- .../include/windows.storage.streams.idl | 2 + 2 files changed, 91 insertions(+), 7 deletions(-) diff --git a/mingw-w64-headers/include/windows.storage.idl b/mingw-w64-headers/include/windows.storage.idl index f47d7adc8..da8d8005d 100644 --- a/mingw-w64-headers/include/windows.storage.idl +++ b/mingw-w64-headers/include/windows.storage.idl @@ -11,6 +11,7 @@ import "inspectable.idl"; import "hstring.idl"; import "windows.foundation.idl"; +import "windows.storage.streams.idl"; namespace Windows { namespace Storage { @@ -29,15 +30,28 @@ namespace Windows { typedef enum ApplicationDataCreateDisposition ApplicationDataCreateDisposition; typedef enum FileAttributes FileAttributes; typedef enum CreationCollisionOption CreationCollisionOption; + typedef enum FileAccessMode FileAccessMode; + interface IStorageFile; + interface IStorageFileStatics; runtimeclass ApplicationData; runtimeclass KnownFolders; + runtimeclass StorageFile; + runtimeclass StorageFolder; } } namespace Windows { namespace Foundation { declare { + interface Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>; + interface Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFolder*>; + interface Windows.Foundation.IAsyncOperation<Windows.Storage.IStorageItem*>; + //~ interface Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IRandomAccessStreamReference*>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.StorageFile*>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.StorageFolder*>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.IStorageItem*>; + //~ interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Storage.Streams.IRandomAccessStreamReference*>; interface Windows.Foundation.TypedEventHandler<Windows.Storage.ApplicationData*, IInspectable*>; } } @@ -88,12 +102,23 @@ namespace Windows { OpenIfExists }; + enum FileAccessMode { + Read, + ReadWrite + }; + #ifdef __WIDL__ [ contract(Windows.Foundation.FoundationContract, 1.0), uuid(a05791e6-cc9f-4687-acab-a364fd785463) ] delegate HRESULT ApplicationDataSetVersionHandler(ISetVersionRequest* setVersionRequest); + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(fef6a824-2fe1-4d07-a35b-b77c50b5f4cc) + ] + delegate HRESULT StreamedFileDataRequestedHandler(Windows.Storage.Streams.IOutputStream* stream); #endif [uuid(4207A996-CA2F-42F7-BDE8-8B10457A7F30)] @@ -134,21 +159,78 @@ namespace Windows { [default] interface IInspectable; } + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Storage.StorageFile), + uuid(5984c710-daf2-43c8-8bb4-a4d3eacfd03f) + ] + interface IStorageFileStatics : IInspectable + { + HRESULT GetFileFromPathAsync(HSTRING path, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT GetFileFromApplicationUriAsync(/* Uri* */ IInspectable* uri, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CreateStreamedFileAsync(HSTRING displayNameWithExtension, StreamedFileDataRequestedHandler* dataRequested, Windows.Storage.Streams.IRandomAccessStreamReference* thumbnail, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT ReplaceWithStreamedFileAsync(IStorageFile* fileToReplace, StreamedFileDataRequestedHandler* dataRequested, Windows.Storage.Streams.IRandomAccessStreamReference* thumbnail, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CreateStreamedFileFromUriAsync(HSTRING displayNameWithExtension, /* Uri* */ IInspectable* uri, Windows.Storage.Streams.IRandomAccessStreamReference* thumbnail, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT ReplaceWithStreamedFileFromUriAsync(IStorageFile* fileToReplace, /* Uri* */ IInspectable* uri, Windows.Storage.Streams.IRandomAccessStreamReference* thumbnail, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Storage.StorageFile), + uuid(fa3f6186-4214-428c-a64c-14c9ac7315ea) + ] + interface IStorageFile : IInspectable + { + [propget] HRESULT FileType(HSTRING *value); + [propget] HRESULT ContentType(HSTRING *value); + HRESULT OpenAsync(FileAccessMode accessMode, /*Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IRandomAccessStreamReference*>*/IInspectable** operation); + HRESULT OpenTransactedWriteAsync(/*IAsyncOperation<StorageStreamTransaction*>*/IInspectable** operation); + HRESULT CopyOverloadDefaultNameAndOptions(IStorageFolder *destinationFolder, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CopyOverloadDefaultOptions(IStorageFolder *destinationFolder, HSTRING desiredNewName, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CopyOverload(IStorageFolder *destinationFolder, HSTRING desiredNewName, NameCollisionOption option, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CopyAndReplaceAsync(IStorageFile *fileToReplace, Windows.Foundation.IAsyncAction** operation); + HRESULT MoveOverloadDefaultNameAndOptions(IStorageFolder *destinationFolder, Windows.Foundation.IAsyncAction** operation); + HRESULT MoveOverloadDefaultOptions(IStorageFolder *destinationFolder, HSTRING desiredNewName, Windows.Foundation.IAsyncAction** operation); + HRESULT MoveOverload(IStorageFolder *destinationFolder, HSTRING desiredNewName, NameCollisionOption option, Windows.Foundation.IAsyncAction** operation); + HRESULT MoveAndReplaceAsync(IStorageFile *fileToReplace, Windows.Foundation.IAsyncAction** operation); + } + [uuid(72D1CB78-B3EF-4F75-A80B-6FD9DAE2944B)] interface IStorageFolder : IInspectable { - HRESULT CreateFileAsyncOverloadDefaultOptions(HSTRING desiredName, /*IAsyncOperation<IStorageFile*>*/IInspectable** operation); - HRESULT CreateFileAsync(HSTRING desiredName, CreationCollisionOption options, /*IAsyncOperation<IStorageFile*>*/IInspectable** operation); - HRESULT CreateFolderAsyncOverloadDefaultOptions(HSTRING desiredName, /*IAsyncOperation<IStorageFolder*>*/IInspectable** operation); - HRESULT CreateFolderAsync(HSTRING desiredName, CreationCollisionOption options, /*IAsyncOperation<StorageFolder*>*/IInspectable** operation); - HRESULT GetFileAsync(HSTRING name, /*IAsyncOperation<StorageFile*>*/IInspectable** operation); - HRESULT GetFolderAsync(HSTRING name, /*IAsyncOperation<StorageFolder*>*/IInspectable** operation); - HRESULT GetItemAsync(HSTRING name, /*IAsyncOperation<StorageItem*>*/IInspectable** operation); + HRESULT CreateFileAsyncOverloadDefaultOptions(HSTRING desiredName, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CreateFileAsync(HSTRING desiredName, CreationCollisionOption options, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT CreateFolderAsyncOverloadDefaultOptions(HSTRING desiredName, Windows.Foundation.IAsyncOperation<StorageFolder*>** operation); + HRESULT CreateFolderAsync(HSTRING desiredName, CreationCollisionOption options, Windows.Foundation.IAsyncOperation<StorageFolder*>** operation); + HRESULT GetFileAsync(HSTRING name, Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile*>** operation); + HRESULT GetFolderAsync(HSTRING name, Windows.Foundation.IAsyncOperation<StorageFolder*>** operation); + HRESULT GetItemAsync(HSTRING name, Windows.Foundation.IAsyncOperation<Windows.Storage.IStorageItem*>** operation); HRESULT GetFilesAsyncOverloadDefaultOptionsStartAndCount(/*IAsyncOperation<IVectorView<StorageFile*>*>*/IInspectable** operation); HRESULT GetFoldersAsyncOverloadDefaultOptionsStartAndCount(/*IAsyncOperation<IVectorView<StorageFolder*>*>*/IInspectable** operation); HRESULT GetItemsAsyncOverloadDefaultStartAndCount(/*IAsyncOperation<IVectorView<StorageItem*>*>*/IInspectable** operation); } + [ + marshaling_behavior(agile), + static(Windows.Storage.IStorageFileStatics, Windows.Foundation.UniversalApiContract, 1.0) + ] + runtimeclass StorageFile + { + [default] interface IStorageFile; + interface IStorageItem; + interface Windows.Storage.Streams.IRandomAccessStreamReference; + // also IInputStreamReference + } + + [ + marshaling_behavior(agile) + ] + runtimeclass StorageFolder + { + [default] interface IStorageFolder; + interface IStorageItem; + } + [uuid(C5AEFD1E-F467-40BA-8566-AB640A441E1D)] interface IApplicationDataContainer : IInspectable { [propget] HRESULT Name(HSTRING* value); diff --git a/mingw-w64-headers/include/windows.storage.streams.idl b/mingw-w64-headers/include/windows.storage.streams.idl index 5bb0d4a7e..cc56e73d9 100644 --- a/mingw-w64-headers/include/windows.storage.streams.idl +++ b/mingw-w64-headers/include/windows.storage.streams.idl @@ -15,6 +15,8 @@ namespace Windows { namespace Streams { interface IBufferFactory; interface IBuffer; + interface IOutputStream; + interface IRandomAccessStreamReference; } } } -- 2.29.2 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
