feat (core-engine): implement multi‑algorithm diff engine (QDiffXCore)#3
Merged
feat (core-engine): implement multi‑algorithm diff engine (QDiffXCore)#3
Conversation
…m characteristics
…me characteristics in DiffAlgorithm interface
- Add complete QDiffAlgorithm abstract interface - Include DiffOperation enum and DiffChange struct - Add QDiffResult class for algorithm output - Implement AlgorithmCapabilities for algorithm metadata - Support configuration and performance estimation This merge integrates the core diff algorithm abstraction layer that will be used by the algorithm manager to support multiple diff algorithms (DMP, DTL, and future algorithms).
…ons (dmpOperation to QDiffXoperation/ dmpchanges to QDiffXchange)
… add line-by-line comparison
…ng from DMPAlgorithm (handle it in a different way using calculateLineByLine and calculateCharByChar
…stimation between text changes
✅ Add complete DMP (Diff-Match-Patch) algorithm implementation - Implements Google's diff-match-patch algorithm with Qt6 modernization - Supports Auto, LineByLine, and CharByChar diff modes - Full configuration system with 7 tunable parameters - Professional line number calculation with left/right tracking - Unicode support and large file handling (up to 10MB) - Enterprise-grade error handling and metadata generation - All QDiffAlgorithm interface methods implemented - Ready for algorithm manager integration Technical details: - Uses native DMP diff_main() with checklines parameter - Proper operation conversion (INSERT/DELETE/EQUAL) - Semantic and efficiency cleanup for optimal results - calculateSimilarity() method for quality metrics - Professional code structure following enterprise standards
…rithm info methods -Name ,Description, capabilities methods -ConfigKeys -Constructor
- Add configuration methods (setConfiguration, getConfigurationKeys) - Add performance estimation methods (estimateComplexity, isRecommendedFor) - Add calculateSimilarity method for quality metrics - Add DTL conversion helper method declarations - Add utility method declarations for line processing
…oved organization
…tation; add TODO comments in DMPAlgorithm and DTLAlgorithm headers
…ug/error reporting -lastError() to get the last error -errorMessage() to get the last error message -lastErrorMessage() to get last error message - errorOutputEnabled functions to handle debugging
…hanced error handling
…ture and QPromise
Add initializeDefaultAlgorithms() method to register DTL and DMP algorithms during QAlgorithmRegistry construction.
add new functions to get/set algorithm configurations and query algorithm metadata initialize default configurations during registry construction
…ger and AlgorithmRegistry - Add algorithm configuration management methods to QAlgorithmRegistry and QAlgorithmManager - Implement new event signals for algorithm state changes and operations - Add reset functionality to QAlgorithmManager - Improve error handling with detailed error signals
- Add error state reset in all public methods - Remove const qualifier from createAlgorithm to allow error emission - Simplify boolean expressions and improve code readability - Emit error signals in createAlgorithm for better error reporting
- Added comprehensive unit tests for QAlgorithmManager and QAlgorithmRegistry functionalities, including algorithm registration, error handling, and configuration management.
…thm registration and availability - Introduced `registerAlgorithmInternal` and `internalGetAvailableAlgorithms` to streamline mutex handling. - Updated `registerAlgorithm` and `unregisterAlgorithm` to utilize internal methods for improved clarity and efficiency. - Corrected algorithm registration calls in `initializeDefaultAlgorithms` to use internal methods. - Adjusted signal emissions to reflect changes in algorithm availability and state management.
…nce algorithm registration checks
Add Unit Tests, Refactor Core AlgorithmManager & Fix Critical Bugs
djad04
added a commit
that referenced
this pull request
Nov 21, 2025
feat (core-engine): implement multi‑algorithm diff engine (QDiffXCore)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This introduces the foundational QAlgorithmManager module, serving as the central engine for all diffing operations. It provides robust capabilities for managing, selecting, and executing various diffing algorithms (“dtl”, “dmp”), and supports both synchronous and asynchronous (non‑blocking, multithreaded ) execution modes ensuring thread safety, high‑performance diff computations.
Key Features and Components Introduced:
-QAlgorithmManager:
-Centralized interface for calculating diffs (synchronous and asynchronous).
-Automatic algorithm selection based on content characteristics (e.g., text length) with a fallback mechanism.
-Manual algorithm selection .
-Comprehensive error handling and reporting for diff operations.
-Management of execution modes (synchronous/asynchronous).
-Configuration management for algorithms.
-Thread-safe execution of diff algorithms.
QAlgorithmRegistry:
-Singleton pattern for global access to registered diff algorithms.
-Dynamic registration and unregistration of new algorithms.
-Factory for creating algorithm instances (std::function-based unique_ptr).
-Retrieval of algorithm information and capabilities.
-Configuration management for individual algorithms.
-Thread safety with QMutex for concurrent access.
Core Algorithms Integration:
-Full implementation and integration of the DMP (Diff Match Patch) algorithm.
-Full implementation and integration of the DTL (Diff Three-Way Algorithm).
-Standardized QDiffAlgorithm interface for extensibility.
Fundamental Data Structures:
-QDiffResult, QDiffOperation, QDiffChange for structured diff output.
-QAlgorithmCapabilities for algorithm metadata.
-QAlgorithmManagerError for specific error types.
Build System Enhancements:
-Restructured CMake configuration to introduce QDiffXCore as a standalone library.
Testing:
-Initial integration of unit tests for QAlgorithmManager and QAlgorithmRegistry to ensure stability and correctness.