diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-05-27 14:21:35 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-27 14:25:17 +0200 |
| commit | a6a1294944d4ce02cbb429ca1aec07ca78d79a88 (patch) | |
| tree | 0122b12b7488a7471a0764a3f1e857c0cc3584b8 /src/subtitle_asset.h | |
| parent | 8c27355abdac31c38c2fd5f41e36097dd5360422 (diff) | |
Tidy handling of _raw_xml.
Before this if we tried to get the XML of an encrypted asset we
would just get an empty string. Now we get a boost::none which
means the verifier can avoid trying to check details of the XML
(and instead raise a warning that you are trying to verify data
that it cannot decrypt).
Diffstat (limited to 'src/subtitle_asset.h')
| -rw-r--r-- | src/subtitle_asset.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h index 2c542b6e..8ec57fce 100644 --- a/src/subtitle_asset.h +++ b/src/subtitle_asset.h @@ -120,7 +120,11 @@ public: virtual int time_code_rate () const = 0; - std::string raw_xml () const { + /** @return Raw XML loaded from, or written to, an on-disk asset, or boost::none if + * - this object was not created from an existing on-disk asset and has not been written to one, or + * - this asset is encrypted and no key is available. + */ + virtual boost::optional<std::string> raw_xml () const { return _raw_xml; } @@ -193,8 +197,8 @@ protected: /** TTF font data that we need */ std::vector<Font> _fonts; - /** The raw XML data that we read from our asset; useful for validation */ - std::string _raw_xml; + /** The raw XML data that we read from or wrote to our asset; useful for validation */ + mutable boost::optional<std::string> _raw_xml; private: friend struct ::pull_fonts_test1; |
