xref: /aosp_15_r20/external/pdfium/core/fxcrt/css/cfx_cssselector.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXCRT_CSS_CFX_CSSSELECTOR_H_
8 #define CORE_FXCRT_CSS_CFX_CSSSELECTOR_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/widestring.h"
13 
14 class CFX_CSSSelector {
15  public:
16   static std::unique_ptr<CFX_CSSSelector> FromString(WideStringView str);
17 
18   CFX_CSSSelector(WideStringView str, std::unique_ptr<CFX_CSSSelector> next);
19   ~CFX_CSSSelector();
20 
is_descendant()21   bool is_descendant() const { return is_descendant_; }
name_hash()22   uint32_t name_hash() const { return name_hash_; }
next_selector()23   const CFX_CSSSelector* next_selector() const { return next_.get(); }
24 
25  private:
set_is_descendant()26   void set_is_descendant() { is_descendant_ = true; }
27 
28   bool is_descendant_ = false;
29   const uint32_t name_hash_;
30   const std::unique_ptr<CFX_CSSSelector> next_;
31 };
32 
33 #endif  // CORE_FXCRT_CSS_CFX_CSSSELECTOR_H_
34