Node.h 787 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/NonnullOwnPtrVector.h>
  10. #include <AK/Variant.h>
  11. #include <AK/Vector.h>
  12. #include <LibXML/FundamentalTypes.h>
  13. namespace XML {
  14. struct Attribute {
  15. Name name;
  16. DeprecatedString value;
  17. };
  18. struct Node {
  19. struct Text {
  20. StringBuilder builder;
  21. };
  22. struct Comment {
  23. DeprecatedString text;
  24. };
  25. struct Element {
  26. Name name;
  27. HashMap<Name, DeprecatedString> attributes;
  28. Vector<NonnullOwnPtr<Node>> children;
  29. };
  30. bool operator==(Node const&) const;
  31. Variant<Text, Comment, Element> content;
  32. Node* parent { nullptr };
  33. };
  34. }