Home | History | Annotate | Download | only in css
      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_CSSSTYLESHEET_H_
      8 #define CORE_FXCRT_CSS_CFX_CSSSTYLESHEET_H_
      9 
     10 #include <map>
     11 #include <memory>
     12 #include <vector>
     13 
     14 #include "core/fxcrt/css/cfx_csssyntaxparser.h"
     15 #include "core/fxcrt/fx_string.h"
     16 
     17 class CFX_CSSStyleRule;
     18 
     19 class CFX_CSSStyleSheet {
     20  public:
     21   CFX_CSSStyleSheet();
     22   ~CFX_CSSStyleSheet();
     23 
     24   bool LoadBuffer(const wchar_t* pBuffer, int32_t iBufSize);
     25 
     26   int32_t CountRules() const;
     27   CFX_CSSStyleRule* GetRule(int32_t index) const;
     28 
     29  private:
     30   void Reset();
     31   CFX_CSSSyntaxStatus LoadStyleRule(
     32       CFX_CSSSyntaxParser* pSyntax,
     33       std::vector<std::unique_ptr<CFX_CSSStyleRule>>* ruleArray);
     34   void SkipRuleSet(CFX_CSSSyntaxParser* pSyntax);
     35 
     36   std::vector<std::unique_ptr<CFX_CSSStyleRule>> m_RuleArray;
     37   std::map<uint32_t, wchar_t*> m_StringCache;
     38 };
     39 
     40 #endif  // CORE_FXCRT_CSS_CFX_CSSSTYLESHEET_H_
     41