Home | History | Annotate | Download | only in pdf
      1 /*
      2  * Copyright 2018 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkPDFTag_DEFINED
      9 #define SkPDFTag_DEFINED
     10 
     11 #include "SkPDFDocument.h"
     12 #include "SkTArray.h"
     13 #include "SkArenaAlloc.h"
     14 #include "SkTHash.h"
     15 
     16 class SkPDFDocument;
     17 struct SkPDFTagNode;
     18 
     19 class SkPDFTagTree {
     20 public:
     21     SkPDFTagTree();
     22     ~SkPDFTagTree();
     23     void init(const SkPDF::StructureElementNode*);
     24     void reset();
     25     int getMarkIdForNodeId(int nodeId, unsigned pageIndex);
     26     SkPDFIndirectReference makeStructTreeRoot(SkPDFDocument* doc);
     27 
     28 private:
     29     SkArenaAlloc fArena;
     30     SkTHashMap<int, SkPDFTagNode*> fNodeMap;
     31     SkPDFTagNode* fRoot = nullptr;
     32     SkTArray<SkTArray<SkPDFTagNode*>> fMarksPerPage;
     33 
     34     SkPDFTagTree(const SkPDFTagTree&) = delete;
     35     SkPDFTagTree& operator=(const SkPDFTagTree&) = delete;
     36 };
     37 
     38 #endif
     39