From e0307861b8e55c9f44e947d8bf82b9c16ec9b963 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 29 Sep 2016 13:25:38 -0700 Subject: Move core/fpdftext/include to core/fpdftext BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2383563002 --- core/fpdftext/cpdf_linkextract.h | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 core/fpdftext/cpdf_linkextract.h (limited to 'core/fpdftext/cpdf_linkextract.h') diff --git a/core/fpdftext/cpdf_linkextract.h b/core/fpdftext/cpdf_linkextract.h new file mode 100644 index 0000000000..159b330f94 --- /dev/null +++ b/core/fpdftext/cpdf_linkextract.h @@ -0,0 +1,46 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFTEXT_CPDF_LINKEXTRACT_H_ +#define CORE_FPDFTEXT_CPDF_LINKEXTRACT_H_ + +#include + +#include "core/fxcrt/include/fx_basic.h" +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_TextPage; + +class CPDF_LinkExtract { + public: + explicit CPDF_LinkExtract(const CPDF_TextPage* pTextPage); + ~CPDF_LinkExtract(); + + void ExtractLinks(); + size_t CountLinks() const { return m_LinkArray.size(); } + CFX_WideString GetURL(size_t index) const; + std::vector GetRects(size_t index) const; + + protected: + void ParseLink(); + bool CheckWebLink(CFX_WideString& str); + bool CheckMailLink(CFX_WideString& str); + + private: + struct Link { + int m_Start; + int m_Count; + CFX_WideString m_strUrl; + }; + + const CPDF_TextPage* const m_pTextPage; + CFX_WideString m_strPageText; + std::vector m_LinkArray; +}; + +#endif // CORE_FPDFTEXT_CPDF_LINKEXTRACT_H_ -- cgit v1.2.3