mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-07 20:31:04 +03:00
LibGfx/ISOBMFF: Remove Box::read_from_stream()
This doesn't have to be a virtual method: it's called from various create_from_stream() methods that have a static type that's created. There's no point in the virtual call here, and it makes it harder to add additional parameters to read_from_stream() in some subclasses.
This commit is contained in:
parent
c84487ed2d
commit
b7a120c47e
Notes:
sideshowbarker
2024-07-17 03:51:15 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/b7a120c47e Pull-request: https://github.com/SerenityOS/serenity/pull/23682 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/timschumi ✅
@ -31,7 +31,6 @@ ErrorOr<BoxHeader> read_box_header(BoxStream& stream);
|
|||||||
struct Box {
|
struct Box {
|
||||||
Box() = default;
|
Box() = default;
|
||||||
virtual ~Box() = default;
|
virtual ~Box() = default;
|
||||||
virtual ErrorOr<void> read_from_stream(BoxStream&) { return {}; }
|
|
||||||
virtual BoxType box_type() const { return BoxType::None; }
|
virtual BoxType box_type() const { return BoxType::None; }
|
||||||
virtual void dump(String const& prepend = {}) const;
|
virtual void dump(String const& prepend = {}) const;
|
||||||
};
|
};
|
||||||
@ -39,7 +38,7 @@ struct Box {
|
|||||||
using BoxList = Vector<NonnullOwnPtr<Box>>;
|
using BoxList = Vector<NonnullOwnPtr<Box>>;
|
||||||
|
|
||||||
struct FullBox : public Box {
|
struct FullBox : public Box {
|
||||||
virtual ErrorOr<void> read_from_stream(BoxStream& stream) override;
|
ErrorOr<void> read_from_stream(BoxStream& stream);
|
||||||
virtual void dump(String const& prepend = {}) const override;
|
virtual void dump(String const& prepend = {}) const override;
|
||||||
|
|
||||||
u8 version { 0 };
|
u8 version { 0 };
|
||||||
@ -59,7 +58,7 @@ struct UnknownBox final : public Box {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~UnknownBox() override = default;
|
virtual ~UnknownBox() override = default;
|
||||||
virtual ErrorOr<void> read_from_stream(BoxStream&) override;
|
ErrorOr<void> read_from_stream(BoxStream&);
|
||||||
virtual BoxType box_type() const override { return m_box_type; }
|
virtual BoxType box_type() const override { return m_box_type; }
|
||||||
virtual void dump(String const& prepend = {}) const override;
|
virtual void dump(String const& prepend = {}) const override;
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ private:
|
|||||||
} \
|
} \
|
||||||
BoxName() = default; \
|
BoxName() = default; \
|
||||||
virtual ~BoxName() override = default; \
|
virtual ~BoxName() override = default; \
|
||||||
virtual ErrorOr<void> read_from_stream(BoxStream& stream) override; \
|
ErrorOr<void> read_from_stream(BoxStream& stream); \
|
||||||
virtual BoxType box_type() const override \
|
virtual BoxType box_type() const override \
|
||||||
{ \
|
{ \
|
||||||
return BoxType::BoxName; \
|
return BoxType::BoxName; \
|
||||||
@ -96,7 +95,7 @@ struct FileTypeBox final : public Box {
|
|||||||
// A box that contains other boxes.
|
// A box that contains other boxes.
|
||||||
struct SuperBox : public Box {
|
struct SuperBox : public Box {
|
||||||
SuperBox() = default;
|
SuperBox() = default;
|
||||||
virtual ErrorOr<void> read_from_stream(BoxStream&) override;
|
ErrorOr<void> read_from_stream(BoxStream&);
|
||||||
virtual void dump(String const& prepend = {}) const override;
|
virtual void dump(String const& prepend = {}) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user