Block.h 966 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2020-2021, the SerenityOS developers.
  3. * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/RefCounted.h>
  9. #include <AK/Vector.h>
  10. #include <LibWeb/CSS/Parser/ComponentValue.h>
  11. #include <LibWeb/CSS/Parser/Token.h>
  12. #include <LibWeb/Forward.h>
  13. namespace Web::CSS::Parser {
  14. class Block : public RefCounted<Block> {
  15. friend class Parser;
  16. public:
  17. Block();
  18. Block(Token, Vector<ComponentValue>&&);
  19. ~Block();
  20. bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
  21. bool is_paren() const { return m_token.is(Token::Type::OpenParen); }
  22. bool is_square() const { return m_token.is(Token::Type::OpenSquare); }
  23. Token const& token() const { return m_token; }
  24. Vector<ComponentValue> const& values() const { return m_values; }
  25. String to_string() const;
  26. private:
  27. Token m_token;
  28. Vector<ComponentValue> m_values;
  29. };
  30. }