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

Unified Diff: core/fpdftext/include/cpdf_linkextract.h

Issue 1896303002: Remove CFX_ArrayTemplate from CPDF_LinkExtract (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Inline and remove Append method. Created 4 years, 8 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
Index: core/fpdftext/include/cpdf_linkextract.h
diff --git a/core/fpdftext/include/cpdf_linkextract.h b/core/fpdftext/include/cpdf_linkextract.h
index 263768ee5d05a7a2b57f033992889a163c498b4b..430d33e6d146dc2a1d4092c2e62f9316257b1938 100644
--- a/core/fpdftext/include/cpdf_linkextract.h
+++ b/core/fpdftext/include/cpdf_linkextract.h
@@ -7,6 +7,9 @@
#ifndef CORE_FPDFTEXT_INCLUDE_CPDF_LINKEXTRACT_H_
#define CORE_FPDFTEXT_INCLUDE_CPDF_LINKEXTRACT_H_
+#include <memory>
+#include <vector>
+
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_string.h"
@@ -14,22 +17,12 @@
class CPDF_TextPage;
-class CPDF_LinkExt {
- public:
- CPDF_LinkExt() {}
- ~CPDF_LinkExt() {}
-
- int m_Start;
- int m_Count;
- CFX_WideString m_strUrl;
-};
-
class CPDF_LinkExtract {
public:
- CPDF_LinkExtract();
+ CPDF_LinkExtract(const CPDF_TextPage* pTextPage);
Lei Zhang 2016/04/19 23:52:06 explicit
~CPDF_LinkExtract();
- FX_BOOL ExtractLinks(const CPDF_TextPage* pTextPage);
+ FX_BOOL ExtractLinks();
int CountLinks() const;
CFX_WideString GetURL(int index) const;
void GetBoundedSegment(int index, int& start, int& count) const;
@@ -42,13 +35,22 @@ class CPDF_LinkExtract {
void DeleteLinkList();
FX_BOOL CheckWebLink(CFX_WideString& strBeCheck);
bool CheckMailLink(CFX_WideString& str);
- void AppendToLinkList(int start, int count, const CFX_WideString& strUrl);
private:
- CFX_ArrayTemplate<CPDF_LinkExt*> m_LinkList;
- const CPDF_TextPage* m_pTextPage;
- CFX_WideString m_strPageText;
+ class Item {
+ public:
+ Item(int start, int count, const CFX_WideString& url)
+ : m_Start(start), m_Count(count), m_strUrl(url) {}
+
+ int m_Start;
+ int m_Count;
+ CFX_WideString m_strUrl;
+ };
+
+ const CPDF_TextPage* const m_pTextPage;
bool m_bIsParsed;
+ CFX_WideString m_strPageText;
+ std::vector<std::unique_ptr<Item>> m_LinkList;
Lei Zhang 2016/04/19 23:52:06 It's not actually a linked list.
dsinclair 2016/04/20 13:05:19 Why unique_ptr<Item> instead of just Item?
Tom Sepez 2016/04/20 19:07:39 Renamed.
Tom Sepez 2016/04/20 19:07:40 Even better. Then I can get rid of the ctor and j
};
#endif // CORE_FPDFTEXT_INCLUDE_CPDF_LINKEXTRACT_H_

Powered by Google App Engine
This is Rietveld 408576698