-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor DataSegment from struct to class and add chained segment capability #673
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
Conversation
📝 WalkthroughWalkthroughConverts the private nested DataSegment from a readonly struct to a private class with get-only properties, adds a Next reference for chaining, and updates GetBitLength, ToBitArray, and WriteTo to traverse chained segments and accumulate length and bit writes across the chain. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant G as QRCodeGenerator
participant DS as DataSegment (current)
participant N as Next DataSegment (optional)
participant BA as BitArray
G->>DS: ToBitArray()
DS->>BA: Create BitArray with total length (via GetBitLength incl. chain)
DS->>DS: WriteTo(BA, startIndex)
note over DS: Encode mode, length, data bits
alt Has Next
DS->>N: WriteTo(BA, updatedIndex)
note over N: Encode its bits and recurse further if chained
end
DS-->>G: Return BitArray
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)QRCoder/QRCodeGenerator/DataSegment.cs (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Next step in supporting multi mode QR codes. It requires an additional allocation, but it's slightly faster presumably due to less copying of data between methods.
Before
After
Summary by CodeRabbit