Skip to content

refactor(document): give internal::Document the read-only defaults nine engines pasted - #804

Merged
andiwand merged 1 commit into
mainfrom
refactor/document-readonly-defaults
Sep 2, 2026
Merged

refactor(document): give internal::Document the read-only defaults nine engines pasted#804
andiwand merged 1 commit into
mainfrom
refactor/document-readonly-defaults

Conversation

@andiwand

@andiwand andiwand commented Sep 2, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Step 1 of #770, the order that issue suggests: the mechanical one, ten files, no behaviour change.

internal::Document now answers the read-only case itself:

bool Document::is_editable() const noexcept { return false; }
bool Document::is_savable(bool) const noexcept { return false; }
void Document::save(std::ostream &) const { throw UnsupportedOperation(); }
void Document::save(std::ostream &, const char *) const { throw UnsupportedOperation(); }

and the nine engines that had pasted exactly that — csv, iwork, markdown, rtf, the three oldms documents, and the ooxml spreadsheet and presentation documents — drop both the declarations and the definitions. odf and ooxml text keep their overrides, which are the only two with anything real to say.

AGENTS.md gains a clause under Adding / extending a document format so the next engine does not paste them back.

Two #include <odr/exceptions.hpp> became unused with the stubs gone and are dropped with them.

No consumer-visible change, so no CHANGELOG.md entry.

Verification

  • odr and odr_test build clean.
  • ./odr_test --gtest_filter='Document*:*Save*:*Edit*:*edit*:*save*' — 56 tests, all pass.

…nine engines pasted

`is_editable` → false, `is_savable` → false and the two throwing `save`
overloads were written out verbatim in csv, iwork, markdown, rtf, the three
`oldms` documents and the ooxml spreadsheet and presentation documents. Only
odf and ooxml text have anything of their own to say, so the base class carries
the read-only answer and the nine copies go.

No behaviour change. Step 1 of #770.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018cMYRXLJdiCkH65Jm2W9B5
@andiwand
andiwand merged commit e80a93a into main Sep 2, 2026
36 checks passed
@andiwand
andiwand deleted the refactor/document-readonly-defaults branch September 2, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant