Chromium Code Reviews| Index: fpdfsdk/include/fsdk_annothandler.h |
| diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h |
| index 369a080a9b2f2134a349c6f50af04158bf9cc085..ddd4b23bbeae8c1a5992bca30c74b0980841e0d2 100644 |
| --- a/fpdfsdk/include/fsdk_annothandler.h |
| +++ b/fpdfsdk/include/fsdk_annothandler.h |
| @@ -8,6 +8,7 @@ |
| #define FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |
| #include <map> |
| +#include <vector> |
| #include "../../core/include/fxcrt/fx_basic.h" |
| @@ -122,7 +123,7 @@ class IPDFSDK_AnnotHandler { |
| class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { |
| public: |
| - CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) |
| + explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) |
| : m_pApp(pApp), m_pFormFiller(NULL) {} |
| ~CPDFSDK_BFAnnotHandler() override {} |
| @@ -303,38 +304,22 @@ class CPDFSDK_AnnotHandlerMgr { |
| CPDFDoc_Environment* m_pApp; |
| }; |
| -typedef int (*AI_COMPARE)(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2); |
| - |
| class CPDFSDK_AnnotIterator { |
|
Tom Sepez
2015/10/21 19:32:58
Can we just kill this class entirely, and have a m
Lei Zhang
2015/10/22 06:56:22
The sorting is not trivial. I changed it to just N
|
| public: |
| - CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, |
| - FX_BOOL bReverse, |
| - FX_BOOL bIgnoreTopmost = FALSE, |
| - FX_BOOL bCircle = FALSE, |
| - CFX_PtrArray* pList = NULL); |
| - virtual ~CPDFSDK_AnnotIterator() {} |
| - |
| - virtual CPDFSDK_Annot* Next(const CPDFSDK_Annot* pCurrent); |
| - virtual CPDFSDK_Annot* Prev(const CPDFSDK_Annot* pCurrent); |
| - virtual CPDFSDK_Annot* Next(int& index); |
| - virtual CPDFSDK_Annot* Prev(int& index); |
| - virtual int Count() { return m_pIteratorAnnotList.GetSize(); } |
| + CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView, bool bReverse); |
| + ~CPDFSDK_AnnotIterator(); |
| - virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView* pPageView, |
| - CFX_PtrArray* pList = NULL); |
| - |
| - void InsertSort(CFX_PtrArray& arrayList, AI_COMPARE pCompare); |
| + CPDFSDK_Annot* Next(size_t* index); |
|
Tom Sepez
2015/10/21 19:32:58
Shouldn't an iterator maintain position on its own
Lei Zhang
2015/10/22 06:56:21
Mmmhmm.
|
| + CPDFSDK_Annot* Prev(size_t* index); |
| + size_t Count() const { return m_iteratorAnnotList.size(); } |
| protected: |
| - CPDFSDK_Annot* NextAnnot(const CPDFSDK_Annot* pCurrent); |
| - CPDFSDK_Annot* PrevAnnot(const CPDFSDK_Annot* pCurrent); |
| - CPDFSDK_Annot* NextAnnot(int& index); |
| - CPDFSDK_Annot* PrevAnnot(int& index); |
| - |
| - CFX_PtrArray m_pIteratorAnnotList; |
| - FX_BOOL m_bReverse; |
| - FX_BOOL m_bIgnoreTopmost; |
| - FX_BOOL m_bCircle; |
| + CPDFSDK_Annot* NextAnnot(size_t* index); |
| + CPDFSDK_Annot* PrevAnnot(size_t* index); |
| + void InsertSort(); |
| + |
| + std::vector<CPDFSDK_Annot*> m_iteratorAnnotList; |
| + const bool m_bReverse; |
| }; |
| #endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_ |