#pragma once #include #include #include class Selector { public: struct SimpleSelector { enum class Type { Invalid, Universal, TagName, Id, Class, }; Type type { Type::Invalid }; enum class PseudoClass { None, Link, Hover, FirstChild, LastChild, OnlyChild, Empty, }; PseudoClass pseudo_class { PseudoClass::None }; String value; enum class AttributeMatchType { None, HasAttribute, ExactValueMatch, }; AttributeMatchType attribute_match_type { AttributeMatchType::None }; String attribute_name; String attribute_value; }; struct ComplexSelector { enum class Relation { None, ImmediateChild, Descendant, AdjacentSibling, GeneralSibling, }; Relation relation { Relation::None }; using CompoundSelector = Vector; CompoundSelector compound_selector; }; explicit Selector(Vector&&); ~Selector(); const Vector& complex_selectors() const { return m_complex_selectors; } Specificity specificity() const; private: Vector m_complex_selectors; };