1 // Copyright 2017 PDFium Authors. All rights reserved. 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 #include <utility> 12 13 #include "core/fxcrt/css/cfx_css.h" 14 #include "core/fxcrt/fx_string.h" 15 16 class CFX_CSSSelector { 17 public: 18 static std::unique_ptr<CFX_CSSSelector> FromString(WideStringView str); 19 20 CFX_CSSSelector(CFX_CSSSelectorType eType, 21 const wchar_t* psz, 22 int32_t iLen, 23 bool bIgnoreCase); 24 ~CFX_CSSSelector(); 25 26 CFX_CSSSelectorType GetType() const; 27 uint32_t GetNameHash() const; 28 CFX_CSSSelector* GetNextSelector() const; 29 SetNext(std::unique_ptr<CFX_CSSSelector> pNext)30 void SetNext(std::unique_ptr<CFX_CSSSelector> pNext) { 31 m_pNext = std::move(pNext); 32 } 33 34 private: SetType(CFX_CSSSelectorType eType)35 void SetType(CFX_CSSSelectorType eType) { m_eType = eType; } 36 37 CFX_CSSSelectorType m_eType; 38 uint32_t m_dwHash; 39 std::unique_ptr<CFX_CSSSelector> m_pNext; 40 }; 41 42 #endif // CORE_FXCRT_CSS_CFX_CSSSELECTOR_H_ 43