StyleFunctionRule.h 898 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2020-2021, the SerenityOS developers.
  3. * Copyright (c) 2021, Sam Atkins <atkinssj@gmail.com>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/String.h>
  9. #include <AK/Vector.h>
  10. namespace Web::CSS {
  11. class StyleComponentValueRule;
  12. class StyleFunctionRule {
  13. friend class Parser;
  14. public:
  15. StyleFunctionRule();
  16. ~StyleFunctionRule();
  17. String const& name() const { return m_name; }
  18. Vector<String> const& values() const { return m_values; }
  19. // FIXME: This method is a temporary hack while much of the parser still expects a string, rather than tokens.
  20. String values_as_string() const
  21. {
  22. StringBuilder builder;
  23. for (auto& value : m_values)
  24. builder.append(value);
  25. return builder.to_string();
  26. }
  27. String to_string() const;
  28. private:
  29. String m_name;
  30. Vector<String> m_values;
  31. };
  32. }