StyleFunctionRule.h 974 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/RefCounted.h>
  9. #include <AK/String.h>
  10. #include <AK/Vector.h>
  11. namespace Web::CSS {
  12. class StyleComponentValueRule;
  13. class StyleFunctionRule : public RefCounted<StyleFunctionRule> {
  14. friend class Parser;
  15. public:
  16. StyleFunctionRule(String name);
  17. ~StyleFunctionRule();
  18. String const& name() const { return m_name; }
  19. Vector<String> const& values() const { return m_values; }
  20. // FIXME: This method is a temporary hack while much of the parser still expects a string, rather than tokens.
  21. String values_as_string() const
  22. {
  23. StringBuilder builder;
  24. for (auto& value : m_values)
  25. builder.append(value);
  26. return builder.to_string();
  27. }
  28. String to_string() const;
  29. private:
  30. String m_name;
  31. Vector<String> m_values;
  32. };
  33. }