New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manually project IVector
and IVectorView
#406
Conversation
Good job. #259 depend on this! |
Been playing around with this, with a couple of suggestions here: https://github.com/halildurmus/win32/pull/1 |
My goodness: this is impressive. You've taken this a whole level further. I'll review the PR, but it'll take me a little while given its length. Would you mind signing a CLA, by the way? https://cla.developers.google.com/about/google-individual |
Thanks.
I signed this last year. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a few relatively minor comments; if you can address these, I think we'll be in good shape to merge and then iterate further.
Hey @timsneath, this test is flaky: If you run this test several times on your computer, you will notice that it sometimes fails. |
Are we good to merge, do you think? (Aside from my own test flake...) |
Yes, I think we're good. |
Thank you for this amazing pull request, Halil! This is awesome 🥳 |
Currently, the only supported types are
String
andWinRT
types such asIHostName
.I found the types that
IVector
andIVectorView
support in here.From the link above, the types that
IVector
andIVectorView
support areWinRT
types, primitive types likeString
,int
,bool
etc., and also some structs likeGUID
,Point
,Size
,DateTime
,Uri
etc.I looked into the
WinMD
files usingILSpy
and the majority of the APIs returnsIVector<String>
orIVector<T extends IInspectable>
. This is also the case forIVectorView
. That's why I didn't add support for the remaining types and some of them were structs likeGUID
,Point
which I don't know how to project them. We can add support for them in the future.While adding support for generic types, I had to find a way to create constructors from generic
T
types. In the beginning, I was storing the constructor tear-off mappings forT
types inside aMap
like this:After learning the number of types that
IVectorView
supports -- which is more than300
, I abandoned this plan and added acreator
parameter to constructors ofIVector
andIVectorView
.This parameter is only required for
WinRT
types likeIVector<IHostName>
and as I assume we will convert methods or properties that returnPointer<COMObject>
to their respective types such asIVector
orIVectorView
(we're gonna expose this as aList
, but first we're gonna turn this into anIVectorView
in the generated code), the consumers won't have to deal with this which is great.I'm looking forward to hearing your thoughts on this.
EDIT: I just figured out how to use
IIterable
andIIterator
. I won't include them in this since this PR has grown quite a bit already.