Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: fpdfsdk/include/fsdk_baseform.h

Issue 1652613002: Remove CGW_ArrayTemplate and its O(n^2 log n) sort. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Another pointless empty() check. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_mgr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/include/fsdk_baseform.h
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index f553bd88483908129b1993ad4a13de58c27543fe..0290ef021d3cf6a7bd391ca2657d8a212a04ebc4 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -14,12 +14,13 @@
#endif
#include <map>
+#include <vector>
#include "core/include/fpdfapi/fpdf_parser.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/include/fxcrt/fx_basic.h"
#include "core/include/fxge/fx_dib.h"
-#include "fsdk_baseannot.h"
+#include "fpdfsdk/include/fsdk_baseannot.h"
class CFFL_FormFiller;
class CPDFSDK_Annot;
@@ -273,14 +274,10 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
FX_BOOL m_bNeedHightlight[kNumFieldTypes];
};
-#define BAI_STRUCTURE 0
-#define BAI_ROW 1
-#define BAI_COLUMN 2
-
-#define CPDFSDK_Annots CFX_ArrayTemplate<CPDFSDK_Annot*>
-#define CPDFSDK_SortAnnots CGW_ArrayTemplate<CPDFSDK_Annot*>
class CBA_AnnotIterator {
public:
+ enum TabOrder { STRUCTURE = 0, ROW, COLUMN };
+
CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
const CFX_ByteString& sType,
const CFX_ByteString& sSubType);
@@ -293,15 +290,19 @@ class CBA_AnnotIterator {
private:
void GenerateResults();
- static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
- static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
- static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot);
+ static CPDF_Rect GetAnnotRect(const CPDFSDK_Annot* pAnnot);
+
+ // Function signature compatible with std::sort().
+ static bool CompareByLeftAscending(const CPDFSDK_Annot* p1,
+ const CPDFSDK_Annot* p2);
+ static bool CompareByTopDescending(const CPDFSDK_Annot* p1,
+ const CPDFSDK_Annot* p2);
+ TabOrder m_eTabOrder;
CPDFSDK_PageView* m_pPageView;
CFX_ByteString m_sType;
CFX_ByteString m_sSubType;
- int m_nTabs;
- CPDFSDK_Annots m_Annots;
+ std::vector<CPDFSDK_Annot*> m_Annots;
};
#endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_mgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698