Better support for interfaces (issue #67) #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the four key improvements requested in issue #67:
✅ #pragma once support:
#pragma oncedirectives are now preserved while other pragma directives (like#pragma warning disable) are removed✅ struct instead of class with public: support: Interfaces are now converted to structs instead of classes, providing better C++ semantics
✅ Virtual destructors: Virtual destructors with
= defaultare automatically added to interface-derived structs to ensure proper cleanup✅ Better template type arguments placement: Template declarations and class/struct definitions are now placed on separate lines for better readability (addresses issue #68)
Technical Implementation
1. #pragma once Support
#pragma(?! once)#pragma oncewhile removing other pragma directives2. Interface to Struct Conversion
interface ITest→struct ITestinterface ITest<T>→template <typename T>\nstruct ITest<T>3. Virtual Destructors
= defaultinstead of= 04. Template Type Arguments Placement
template <typename T> class Foo→template <typename T>\nclass FooTest Coverage
Added comprehensive test cases covering:
#pragma oncepreservation vs#pragma warningremovalAll existing tests continue to pass, ensuring backward compatibility.
Example Transformations
Before:
After:
🤖 Generated with Claude Code
Resolves #67