Skip to content

refactor(xml, png): give the xml and png helpers their own internal packages - #792

Merged
andiwand merged 1 commit into
mainfrom
refactor/xml-png-packages
Aug 30, 2026
Merged

refactor(xml, png): give the xml and png helpers their own internal packages#792
andiwand merged 1 commit into
mainfrom
refactor/xml-png-packages

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

util/xml_util moves into the existing xml package, next to XmlFile, and util/png_util becomes a package of its own. The namespaces follow: util::xmlxml, util::pngpng.

util is for helpers that belong to no engine, and neither of these does. Every xml-reading and xml-writing engine goes through the parse and the escaping; the png writer is the encoder pdf image extraction and svm bitmaps hand their pixels to. The xml half also lands where xml:: already resolved for open_strategy, svg_file and odf_flat_file — those files were spelling the namespace before the helpers arrived in it.

from to
src/odr/internal/util/xml_util.{hpp,cpp} src/odr/internal/xml/xml_util.{hpp,cpp}
src/odr/internal/util/png_util.{hpp,cpp} src/odr/internal/png/png_util.{hpp,cpp}
test/src/internal/util/xml_util_test.cpp test/src/internal/xml/xml_util_test.cpp
test/src/internal/util/png_util_test.cpp test/src/internal/png/png_util_test.cpp

Contents are unchanged apart from the namespace; the rest of the diff is call sites (xml::parse, xml::escape_attribute, png::write), the two CMake source lists, and re-sorted includes.

Docs: the root AGENTS.md directory map (the util/ row, a new png/ row, the xml/ row, and the pugixml-layout note that cites xml_util.cpp), xml/AGENTS.md — which gains a short section saying the package is now shared plumbing and a format — svg/AGENTS.md, which cited a util::xml::escape that had not gone by that name for a while, and docs/design/editing.md.

No CHANGELOG.md entry: refactoring is in the generated per-PR list already.

Testing

odr and odr_test build clean. 63 tests across the xml, png, svg, ooxml, odf and pdf-image suites pass. The data-driven suites did not run — test/data is not fetched in this checkout — so CI is the first place the full suite sees this.

…ackages

`util/xml_util` moves into the existing `xml` package, next to `XmlFile`, and
`util/png_util` becomes a package of its own. The namespaces follow:
`util::xml` -> `xml`, `util::png` -> `png`.

`util` is for helpers that belong to no engine. Neither of these does: every
xml-reading and xml-writing engine goes through the parse and the escaping, and
the png writer is the encoder pdf image extraction and svm bitmaps hand their
pixels to. The xml half also lands where `xml::` already resolved for
`open_strategy`, `svg_file` and `odf_flat_file`.

Contents are unchanged apart from the namespace.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MjtSRoykPTFpvHzaJmVLJk
@andiwand
andiwand merged commit 2166fc3 into main Aug 30, 2026
26 of 27 checks passed
@andiwand
andiwand deleted the refactor/xml-png-packages branch August 30, 2026 19:12
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