ladybird/Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.h
Sam Atkins 89bfde29dc LibWeb: Convert some CSS parser *Rule classes to using pointers
Previously these were all passed around by value, but some of them
(StyleComponentValueRule and StyleBlockRule) want to include each
other as fields, so this had to change.
2021-07-11 23:19:56 +02:00

42 lines
974 B
C++

/*
* Copyright (c) 2020-2021, the SerenityOS developers.
* Copyright (c) 2021, Sam Atkins <atkinssj@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Vector.h>
namespace Web::CSS {
class StyleComponentValueRule;
class StyleFunctionRule : public RefCounted<StyleFunctionRule> {
friend class Parser;
public:
StyleFunctionRule(String name);
~StyleFunctionRule();
String const& name() const { return m_name; }
Vector<String> const& values() const { return m_values; }
// FIXME: This method is a temporary hack while much of the parser still expects a string, rather than tokens.
String values_as_string() const
{
StringBuilder builder;
for (auto& value : m_values)
builder.append(value);
return builder.to_string();
}
String to_string() const;
private:
String m_name;
Vector<String> m_values;
};
}