How hanlinaumonde/projet-comput-science works
Project Type and Purpose
• The project is a calculator application that supports various numerical literal types (e.g., integers, complexes, reals, rationals, expressions, and even programs) and uses a stack mechanism. Additionally, there are GUI components (suggested by files prefixed with “q” such as qcalculateur, qclavier, and qvue_secondaire) likely built using a Qt interface.
• The README provides build instructions with CMake, indicating that it’s a C++ project with a focus on modular design.
Analyzing the File Structure
• Top-level directories include:
• – Contains header files for all major classes (e.g., controleur, various litterale types, operator classes, and the stack “pile”).
• src – Contains the implementation (.cpp) files corresponding to the headers.
• Notable naming patterns:
• “litterale_*” indicates different classes representing numerical or programmatic literal types.
• “operateur_*” indicates the hierarchy of operator classes (directory distinguishes between accessible, binary, evaluative, numerical, and unary variants).
• “q…” classes (qcalculateur, qclavier, qvue_secondaire) imply that there is an interactive or GUI-based component.
• Other key files include CMakeLists.txt (build configuration) and Erreurs.txt (maybe for logging error or exception messages).
Main Components of the System (for Diagramming)
a. Core Calculation Engine:
• Controller (controleur): Acts as the central coordinator managing input, operation execution, and stack interactions.
• Literals Module:
• Different “litterale_” classes: Represent various numeric types; structure the domain-level objects.
• Operators Module:
• Different “operateur_” classes: Define arithmetic or evaluative operations and their relationships with literals.
• Pile/Stack:
• Manages operational stacks (pile) used by the calculator for storing operands and results.
• Exception Handling:
• Header files like exceptions.h for managing errors.
b. User Interface (UI) Layer:
• Qt-based GUI Components:
• qcalculateur: Likely the main calculator interface.
• qclavier: Represents the on-screen keypad.
• qvue_secondaire: Might serve as a secondary view (could be for displaying detailed results or logs).
c. Resource Management:
d. Integration & Data Flow:
• The main.cpp file is the entry point that initializes both the calculation engine and the UI.
• Interaction flows from UI components (user input) to the controller, which then applies operator logic to literals, manages the stack, and updates the UI accordingly.
Relationships and Interactions
• The user interacts with the UI, and these interactions are transmitted via the controller.
• The controller uses operator classes to process input and perform calculations on the various literal types.
• The stack (pile) maintains intermediate or past results, while exception handling monitors erroneous operations.
• Data and configuration from the “res” folder are loaded at startup to support the UI and domain definitions.
Architectural Patterns and Design Principles
• Separation of Concerns:
• The project is clearly modular with distinct layers: UI (presentation) vs. calculation logic (business logic).
• MVC-like Approach (or at least some controller-based design):
• The “controleur” acts as the mediator between the model (literals, operators, and the stack) and the view (Qt-based UI components).
• Object-oriented design:
• Inheritance is used to extend functionalities of operators and literal types.