Skip to content

feat(document): deprecate the four drawing element types - #818

Closed
andiwand wants to merge 1 commit into
mainfrom
deprecate-drawing-elements
Closed

feat(document): deprecate the four drawing element types#818
andiwand wants to merge 1 commit into
mainfrom
deprecate-drawing-elements

Conversation

@andiwand

@andiwand andiwand commented Sep 5, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

The deprecation half of #773. Nothing changes at runtime, and no emitted html
moves — this only marks what the follow-up removes, so consumers get a release
that warns before the one that breaks.

What is deprecated

  • ElementType::rect, ::line, ::circle, ::custom_shape
  • odr::Rect, odr::Line, odr::Circle, odr::CustomShape
  • Element::as_rect(), ::as_line(), ::as_circle(), ::as_custom_shape()

Mirrored in the bindings: @Deprecated on the Java classes, ElementType
constants and Element.as* methods; DEPRECATED_MSG_ATTRIBUTE on the ObjC
interfaces and ODRElementType values; docstrings on the pybind classes,
enumerators and methods. Wasm binds no element types, so it is untouched.

The replacement lands in the stacked breaking PR: Frame gains a
ShapeType shape_type() discriminator plus the geometry the four classes
carried, and the odf parser maps every draw:* shape onto it. frame is
already the generic-shape element in five of the six engines — only odf ever
produced the other four.

ODR_DEPRECATED

[[deprecated]] on an api the library itself renders through would fail CI,
which builds with -Werror. So definitions.hpp gains

#ifdef ODR_INTERNAL_BUILD
#define ODR_DEPRECATED(message)
#else
#define ODR_DEPRECATED(message) [[deprecated(message)]]
#endif

and ODR_INTERNAL_BUILD is set PRIVATE on odr, odr_test, odr_jni,
pyodr_core and odr_apple — the library and its own mirrors, which have to
keep serving what they deprecate. Consumers building against the installed
headers get the attribute. ODRDocumentElement.mm needs one file-scope
-Wdeprecated-declarations pragma on top, for the ObjC attributes the macro
does not reach.

This also gives the repo's existing doc-comment-only deprecations
(html.hpp, global_params.hpp) somewhere to grow a real attribute.

Verified

  • -Werror build with -DODR_TEST=ON -DODR_JNI=ON -DODR_PYTHON=ON: clean.
  • ODRDocumentElement.mm syntax-checked with -Werror separately (the apple
    target is not in that job).
  • A consumer TU compiled without ODR_INTERNAL_BUILD warns on all three kinds
    of use — the enumerator, the as_* and the class.
  • odr_test, odf and html filters: 67 passing.

`Rect`, `Line`, `Circle` and `CustomShape`, their `ElementType` values and
the matching `Element::as_*` collapse into `Frame`, which gains a shape kind.
Only the odf parser ever produced them; the other five engines already funnel
every shape into `frame`. Towards #773.

New `ODR_DEPRECATED` in `definitions.hpp` carries the attribute, and expands
to nothing under `ODR_INTERNAL_BUILD` so the library, the tests and the
bindings keep serving what they deprecate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F8WoFb87bkWF7sow8zeRHe
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