From 48711ae4e01f2ea43016d6e4b94bd15ad7b13f42 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 12 Apr 2026 14:40:47 +0200 Subject: Separate data and location in the verification note. --- src/verify.h | 70 ++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/verify.h b/src/verify.h index cb9801ef..c697c8c9 100644 --- a/src/verify.h +++ b/src/verify.h @@ -606,14 +606,14 @@ public: VerificationNote(Code code, boost::filesystem::path file) : _code(code) { - _data[Data::FILE] = file; + _location[Location::FILE] = file; } VerificationNote(Code code, boost::filesystem::path file, uint64_t line) : _code (code) { - _data[Data::FILE] = file; - _data[Data::LINE] = line; + _location[Location::FILE] = file; + _location[Location::LINE] = line; } Type type() const; @@ -625,34 +625,25 @@ public: private: enum class Data { ANNOTATION_TEXT, - ASSET_ID, - ASSET_MAP_ID, BIT_DEPTH, CALCULATED_HASH, CAPABILITIES, CODE_BLOCK_HEIGHT, CODE_BLOCK_WIDTH, - COMPONENT, CONTENT_KIND, CONTENT_VERSION, - CPL_ID, DURATION, ERROR, - FILE, ///< path of file containing the error - FRAME, FRAME_RATE, GUARD_BITS, ISSUE_DATE, LANGUAGE, - LINE, ///< error line number within the FILE LOAD_FONT_ID, MAIN_PICTURE_ACTIVE_AREA, OTHER_ASSET_ID, OTHER_DURATION, - PKL_ID, POC_MARKER, POC_MARKERS, - REEL_INDEX, ///< reel index, counting from 0 REFERENCE_HASH, SIZE_IN_BYTES, SIZE_IN_PIXELS, @@ -662,6 +653,18 @@ private: XML_NAMESPACE, }; + enum class Location { + ASSET_ID, + ASSET_MAP_ID, + COMPONENT, + CPL_ID, + FILE, ///< path of file containing the error + FRAME, + LINE, ///< error line number within the FILE + PKL_ID, + REEL_INDEX, ///< reel index, counting from 0 + }; + template boost::optional data(Data key) const { @@ -672,31 +675,41 @@ private: return boost::any_cast(iter->second); } + template + boost::optional location(Location key) const + { + auto iter = _location.find(key); + if (iter == _location.end()) { + return {}; + } + return boost::any_cast(iter->second); + } + public: boost::optional file () const { - return data(Data::FILE); + return location(Location::FILE); } boost::optional line () const { - return data(Data::LINE); + return location(Location::LINE); } VerificationNote& set_frame(int frame) { - _data[Data::FRAME] = frame; + _location[Location::FRAME] = frame; return *this; } boost::optional frame() const { - return data(Data::FRAME); + return location(Location::FRAME); } VerificationNote& set_component(int component) { - _data[Data::COMPONENT] = component; + _location[Location::COMPONENT] = component; return *this; } boost::optional component() const { - return data(Data::COMPONENT); + return location(Location::COMPONENT); } VerificationNote& set_size_in_bytes(uint64_t size) { @@ -718,12 +731,12 @@ public: } VerificationNote& set_asset_id(std::string id) { - _data[Data::ASSET_ID] = id; + _location[Location::ASSET_ID] = id; return *this; } boost::optional asset_id() const { - return data(Data::ASSET_ID); + return location(Location::ASSET_ID); } VerificationNote& set_other_asset_id(std::string other_id) { @@ -763,39 +776,39 @@ public: } VerificationNote& set_cpl_id(std::string id) { - _data[Data::CPL_ID] = id; + _location[Location::CPL_ID] = id; return *this; } boost::optional cpl_id() const { - return data(Data::CPL_ID); + return location(Location::CPL_ID); } VerificationNote& set_pkl_id(std::string id) { - _data[Data::PKL_ID] = id; + _location[Location::PKL_ID] = id; return *this; } boost::optional pkl_id() const { - return data(Data::PKL_ID); + return location(Location::PKL_ID); } VerificationNote& set_asset_map_id(std::string id) { - _data[Data::ASSET_MAP_ID] = id; + _location[Location::ASSET_MAP_ID] = id; return *this; } boost::optional asset_map_id() const { - return data(Data::ASSET_MAP_ID); + return location(Location::ASSET_MAP_ID); } VerificationNote& set_reel_index(int index) { - _data[Data::REEL_INDEX] = index; + _location[Location::REEL_INDEX] = index; return *this; } boost::optional reel_index() const { - return data(Data::REEL_INDEX); + return location(Location::REEL_INDEX); } VerificationNote& set_error(std::string error) { @@ -990,6 +1003,7 @@ public: private: Code _code; std::map _data; + std::map _location; }; -- cgit v1.2.3