#5455·poco

Replace `enum` with `enum class`

Author: mikomikotaishiCreated Aug 19, 2026Updated Aug 30, 2026
Labelsfeature

Is your feature request related to a problem? Please describe.

Currently, we use enum in many classes (such as Poco::PDF::TextAnnotation::IconType), and even as free enumerators themselves (such as Poco::JSONOptions). While enum provides the benefit of not needing to qualify the enumerator type's name itself (i.e. simply Poco::PDF::TextAnnotation::ANNOTATION_ICON_KEY rather than Poco::PDF::TextAnnotation::IconType::ANNOTATION_ICON_KEY, or Poco::JSON_ESCAPE_UNICODE rather than Poco::JSONOptions::JSON_ESCAPE_UNICODE), this still bears problems such as these enumerators are weakly-typed and always implicitly convert to int.

Describe the solution you'd like

The possible ways to approach this are that all classes with a nested enum should receive using enum X; within; this ensures no breakage between two versions. For enumerators that include the prefix, such as ANNOTATION_ICON_KEY and JSON_ESCAPE_UNICODE, I think we should consider dropping the prefixes entirely and just write TextAnnotation::ICON_KEY, JSONOptions::ESCAPE_UNICODE; in the meantime, continue to provide the older enumerator name and assign it the same value, but mark it [[deprecated("ANNOTATION_ICON_KEY is deprecated; use ICON_KEY instead")]].

Describe alternatives you've considered

N/A; no other ways to ensure type safety on enumerators.