# machineteto/dsa-word architecture

> Architecture diagram of the GitHub repository machineteto/dsa-word, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/machineteto/dsa-word
- Repository: https://github.com/machineteto/dsa-word

## Overview

This is a small C++ text-editing exercise, demonstrated through a console entry point rather than a full interactive application. The visible workflow builds a line-based document, moves a cursor, inserts characters, and exercises undo/redo while displaying the result. Internally, the editor coordinates document and cursor state with two action stacks; the document is a doubly linked list of line nodes. The headers declare additional editing features, but their implementations are not shown, so they are not mapped as working capabilities.

Main entry points: [`main.cpp`](https://github.com/machineteto/dsa-word/blob/main/main.cpp) (Demo Entry), [`textEdit.h`](https://github.com/machineteto/dsa-word/blob/main/textEdit.h) (Text Editor), [`textDoc.h`](https://github.com/machineteto/dsa-word/blob/main/textDoc.h) (Text Document), [`cursor.h`](https://github.com/machineteto/dsa-word/blob/main/cursor.h) (Cursor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Console Demo"]
  node_main["Demo Entry<br/>[main.cpp]"]
end

subgraph group_editing["Editing"]
  node_editor["Text Editor<br/>[textEdit.h]"]
  node_cursor["Cursor<br/>[cursor.h]"]
end

subgraph group_storage["Document Storage"]
  node_document["Text Document<br/>[textDoc.h]"]
  node_line["Line Node<br/>[lineNode.h]"]
end

subgraph group_history["Undo History"]
  node_stack["Action Stack<br/>[actionStack.h]"]
  node_action["Edit Action<br/>[action.h]"]
end

node_user(("Demo Runner"))

node_user -->|"runs"| node_main
node_main -->|"exercises"| node_editor
node_main -->|"demonstrates"| node_document
node_main -->|"moves"| node_cursor
node_main -->|"demonstrates"| node_stack
node_editor -->|"edits"| node_document
node_editor -->|"moves"| node_cursor
node_editor -->|"records history"| node_stack
node_stack -->|"stores"| node_action
node_cursor -->|"reads lines"| node_document
node_document -->|"links lines"| node_line

click node_main "https://github.com/machineteto/dsa-word/blob/main/main.cpp"
click node_editor "https://github.com/machineteto/dsa-word/blob/main/textEdit.h"
click node_cursor "https://github.com/machineteto/dsa-word/blob/main/cursor.h"
click node_document "https://github.com/machineteto/dsa-word/blob/main/textDoc.h"
click node_line "https://github.com/machineteto/dsa-word/blob/main/lineNode.h"
click node_stack "https://github.com/machineteto/dsa-word/blob/main/actionStack.h"
click node_action "https://github.com/machineteto/dsa-word/blob/main/action.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main toneBlue
class node_editor,node_cursor toneAmber
class node_document,node_line toneMint
class node_stack,node_action toneRose
class node_user toneIndigo
```

## Components

### Console Demo

- [Demo Entry](https://github.com/machineteto/dsa-word/blob/main/main.cpp): `main.cpp`

### Editing

- [Text Editor](https://github.com/machineteto/dsa-word/blob/main/textEdit.h): `textEdit.h`
- [Cursor](https://github.com/machineteto/dsa-word/blob/main/cursor.h): `cursor.h`

### Document Storage

- [Text Document](https://github.com/machineteto/dsa-word/blob/main/textDoc.h): `textDoc.h`
- [Line Node](https://github.com/machineteto/dsa-word/blob/main/lineNode.h): `lineNode.h`

### Undo History

- [Action Stack](https://github.com/machineteto/dsa-word/blob/main/actionStack.h): `actionStack.h`
- [Edit Action](https://github.com/machineteto/dsa-word/blob/main/action.h): `action.h`

### Other components

- **Demo Runner**

## Connections

- Demo Runner → Demo Entry: runs (evidence: `main.cpp`)
- Demo Entry → Text Editor: exercises (evidence: `main.cpp`)
- Demo Entry → Text Document: demonstrates (evidence: `main.cpp`)
- Demo Entry → Cursor: moves (evidence: `main.cpp`)
- Demo Entry → Action Stack: demonstrates (evidence: `main.cpp`)
- Text Editor → Text Document: edits (evidence: `textEdit.h`)
- Text Editor → Cursor: moves (evidence: `textEdit.h`)
- Text Editor → Action Stack: records history (evidence: `textEdit.h`)
- Action Stack → Edit Action: stores (evidence: `actionStack.h`)
- Cursor → Text Document: reads lines (evidence: `cursor.h`)
- Text Document → Line Node: links lines (evidence: `textDoc.h`)
