Node.h 751 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DeprecatedString.h>
  8. #include <AK/HashMap.h>
  9. #include <AK/Variant.h>
  10. #include <AK/Vector.h>
  11. #include <LibXML/FundamentalTypes.h>
  12. namespace XML {
  13. struct Attribute {
  14. Name name;
  15. DeprecatedString value;
  16. };
  17. struct Node {
  18. struct Text {
  19. StringBuilder builder;
  20. };
  21. struct Comment {
  22. DeprecatedString text;
  23. };
  24. struct Element {
  25. Name name;
  26. HashMap<Name, DeprecatedString> attributes;
  27. Vector<NonnullOwnPtr<Node>> children;
  28. };
  29. bool operator==(Node const&) const;
  30. Variant<Text, Comment, Element> content;
  31. Node* parent { nullptr };
  32. };
  33. }