https://github.com/taharachedi/custom_stack_with_redo_undo_feature-cpp
A C++ class for managing strings with built-in undo/redo functionality using stacks. π
https://github.com/taharachedi/custom_stack_with_redo_undo_feature-cpp
datastructures stack string-manipulation undo-redo
Last synced: about 1 year ago
JSON representation
A C++ class for managing strings with built-in undo/redo functionality using stacks. π
- Host: GitHub
- URL: https://github.com/taharachedi/custom_stack_with_redo_undo_feature-cpp
- Owner: taharachedi
- Created: 2025-03-08T05:58:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T06:06:27.000Z (over 1 year ago)
- Last Synced: 2025-03-08T06:28:34.438Z (over 1 year ago)
- Topics: datastructures, stack, string-manipulation, undo-redo
- Language: C++
- Homepage:
- Size: 0 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Custom Stack with REDO & UNDO Featureβ‘
> **A C++ class for managing strings with built-in undo/redo functionality using stacks. π**
---
## π Project Overview
The `clsMyString` class provides a **string management system** with the ability to undo and redo changes. It uses **two stacks** to track modifications, allowing users to revert or reapply changes efficiently.
### πΉ Core Functionalities:
- **Set and Get String Values** βοΈ
- **Undo Last Change** βͺ
- **Redo Last Undone Change** β©
This implementation ensures a smooth user experience by maintaining a **history of modifications**, making it ideal for text editors, command-based interfaces, and other applications requiring version control.
---
## β¨ Features
### πΉ Basic String Operations
- **`Set(Value)`**: Updates the string and stores the previous value for undo.
- **`Get()`**: Retrieves the current string value.
- **`Value` Property**: Accessor for the string (supports `get` and `set`).
### πΉ Undo/Redo Functionality
- **`Undo()`**: Restores the string to its previous state.
- **`Redo()`**: Reapplies the last undone change.
---
## π How It Works
### πΉ Managing String Changes
- When `Set(Value)` is called, the current value is pushed onto the **Undo stack** before updating.
- Performing an **Undo** moves the current value to the **Redo stack** and retrieves the last stored value from **Undo**.
- Performing a **Redo** moves the current value back to **Undo** and retrieves the last stored value from **Redo**.
### πΉ Memory Management
- Only stores necessary changes, preventing excessive memory usage.
- Ensures efficient access through **stack-based** operations.
---
## π Potential Enhancements
- π **Multi-level Undo/Redo Optimization**: Allowing configurable history depth.
- π **Change Tracking**: Storing granular changes rather than full strings.
- π **Persistent Storage**: Saving history to a file for session restoration.
- π **Thread Safety**: Implementing concurrency control for multi-threaded environments.
---
## βοΈ Technologies Used
- **Language**: C++
- **Stack-based Undo/Redo**: Efficient history tracking.
- **Dynamic String Management**: Using `std::string` for flexible operations.
---
## π― Learning Outcomes
This project demonstrates:
- β
**Efficient string modification tracking**
- β
**Undo/Redo functionality with stack data structures**
- β
**Property-based access in C++ (`__declspec(property)`)**
- β
**Memory-efficient implementation of reversible actions**
---
## π License
This project is **open-source**. Feel free to modify and enhance it! π
---
## π€ Contributing
Contributions are welcome! If you have ideas for improvements, submit a Pull Request.
---
## π Ready to Explore?
### π How to Run
1. **Download** the repository.
2. **Include** `clsMyString.h` in your project.
3. **Compile & Run** your C++ program (e.g., `g++ main.cpp -o output`).
4. **Test** different string modifications, undo, and redo operations.