mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibXML: Add helpers for extracting node contents if its type is known
This commit is contained in:
parent
3a42ef4118
commit
b40ab55830
Notes:
sideshowbarker
2024-07-17 03:18:29 +09:00
Author: https://github.com/DanShaders Commit: https://github.com/SerenityOS/serenity/commit/b40ab55830 Pull-request: https://github.com/SerenityOS/serenity/pull/20629
@ -36,5 +36,14 @@ struct Node {
|
||||
|
||||
Variant<Text, Comment, Element> content;
|
||||
Node* parent { nullptr };
|
||||
|
||||
bool is_text() const { return content.has<Text>(); }
|
||||
Text const& as_text() const { return content.get<Text>(); }
|
||||
|
||||
bool is_comment() const { return content.has<Comment>(); }
|
||||
Comment const& as_comment() const { return content.get<Comment>(); }
|
||||
|
||||
bool is_element() const { return content.has<Element>(); }
|
||||
Element const& as_element() const { return content.get<Element>(); }
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user