rust-qt / ritual

Use C++ libraries from Rust
Apache License 2.0
1.22k stars 49 forks source link

Add universal prefix removal (Issue #25) #70

Closed moreheadm closed 5 years ago

moreheadm commented 6 years ago

This PR adds universal removal to the API. A caller can specify which prefixes to remove in a similar matter to other Config members. Automatic detection is not yet implemented, but shouldn't be hard to add.

I tried to match the style and semantics of existing code. Hope this helps!

Riateche commented 5 years ago

Thank you for your contribution! Sorry for the lack of reply - there was a pause in the project's development. We're now trying to implement a more advanced Rust name generation that will also solve the platform compatibility issues we've encountered in the first alpha version. One of the key differences is that the assigning Rust identifiers is now incremental: the generator remembers which identifiers have already been taken and chooses a new identifier for each new item individually.

It's not decided yet how we want to configure prefix removal. Ideally, there should be some API that allows a wide range of transformations, and possibly some support for arbitrary hooks that can override the naming logic entirely. Next, as mentioned in #25, we're thinking about implementing automatic prefix removal that will detect that all generated identifiers in a module share a common prefix and thus can be renamed. However, it's unclear what happens when a new identifier is introduced in the module after that, especially if the new identifier doesn't share the common prefix.