OLD | NEW |
| (Empty) |
1 | |
2 /* | |
3 * Copyright 2010 The Android Open Source Project | |
4 * | |
5 * Use of this source code is governed by a BSD-style license that can be | |
6 * found in the LICENSE file. | |
7 */ | |
8 | |
9 | |
10 #ifndef SkPDFCatalog_DEFINED | |
11 #define SkPDFCatalog_DEFINED | |
12 | |
13 #include "SkPDFTypes.h" | |
14 #include "SkTDArray.h" | |
15 #include "SkTHash.h" | |
16 | |
17 /** \class SkPDFCatalog | |
18 | |
19 The PDF catalog manages object numbers. It is used | |
20 to create the PDF cross reference table. | |
21 */ | |
22 class SkPDFCatalog { | |
23 public: | |
24 SkPDFCatalog(); | |
25 ~SkPDFCatalog(); | |
26 | |
27 /** Add the passed object to the catalog. | |
28 * @param obj The object to add. | |
29 * @return True iff the object was not already added to the catalog. | |
30 */ | |
31 bool addObject(SkPDFObject* obj); | |
32 | |
33 /** Get the object number for the passed object. | |
34 * @param obj The object of interest. | |
35 */ | |
36 int32_t getObjectNumber(SkPDFObject* obj) const; | |
37 | |
38 /** Set substitute object for the passed object. | |
39 Refs substitute. | |
40 */ | |
41 void setSubstitute(SkPDFObject* original, SkPDFObject* substitute); | |
42 | |
43 /** Find and return any substitute object set for the passed object. If | |
44 * there is none, return the passed object. | |
45 */ | |
46 SkPDFObject* getSubstituteObject(SkPDFObject* object) const; | |
47 | |
48 const SkTDArray<SkPDFObject*>& objects() const { return fObjects; } | |
49 | |
50 private: | |
51 SkTDArray<SkPDFObject*> fObjects; | |
52 SkTHashMap<SkPDFObject*, int32_t> fObjectNumbers; | |
53 SkTHashMap<SkPDFObject*, SkPDFObject*> fSubstituteMap; | |
54 }; | |
55 | |
56 #endif | |
OLD | NEW |