• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_
8 #define XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_
9 
10 #include <memory>
11 #include <unordered_map>
12 #include <vector>
13 
14 #include "core/fxcrt/fx_string.h"
15 #include "xfa/fde/css/cfde_csssyntaxparser.h"
16 
17 class CFDE_CSSStyleRule;
18 
19 class CFDE_CSSStyleSheet {
20  public:
21   CFDE_CSSStyleSheet();
22   ~CFDE_CSSStyleSheet();
23 
24   bool LoadBuffer(const FX_WCHAR* pBuffer, int32_t iBufSize);
25 
26   int32_t CountRules() const;
27   CFDE_CSSStyleRule* GetRule(int32_t index) const;
28 
29  private:
30   void Reset();
31   FDE_CSSSyntaxStatus LoadStyleRule(
32       CFDE_CSSSyntaxParser* pSyntax,
33       std::vector<std::unique_ptr<CFDE_CSSStyleRule>>* ruleArray);
34   void SkipRuleSet(CFDE_CSSSyntaxParser* pSyntax);
35 
36   std::vector<std::unique_ptr<CFDE_CSSStyleRule>> m_RuleArray;
37   std::unordered_map<uint32_t, FX_WCHAR*> m_StringCache;
38 };
39 
40 #endif  // XFA_FDE_CSS_CFDE_CSSSTYLESHEET_H_
41