kbilsted / NotepadPlusPlusPluginPack.Net

.Net package to install into visual studio to make plugins for Notepad++
Apache License 2.0
165 stars 52 forks source link

Fixed scintilla interface function signatures #72

Closed mahee96 closed 3 years ago

mahee96 commented 3 years ago
mahee96 commented 3 years ago

This PR#72 should fix#70

kbilsted commented 3 years ago

you can combine enums in c# if you mark them with flags https://docs.microsoft.com/en-us/dotnet/api/system.flagsattribute?view=net-5.0

mahee96 commented 3 years ago

Yeah that is true, but enums are typed so a enum constant acn be or'd with enum constant of same type but it won't work with another enum type constant or another type such as int. So to better maintain compatibility with existing C++ classes which the original scintilla is based upon, I suggest we better go with plain int instead of enum.

Even if we declare it as flags/FlagAttribute, it can't be added simply as we would do with int flags like in C++

0x01 + 0xFE = 0xFF (arithmetic or logical both can be applied)

As in the issue #70 the line numbers/counters might be or'd or added to the level enumeration where line numbers are int and if enum is presented, it restricts the api usage by strong param types.

Also Scintilla documentation shows the usage of int instead of enum for enumeration types.

Correct me if I am wrong in saying enums are strictly typed.

mahee96 commented 3 years ago

Hmm seems like C# enums are not strictly classes as in java. So probably a type cast to int and declaring enum as Flag should have sufficed in first place?...interesting...