Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_textpagefind.h
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_
8#define CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_
9
10#include <stddef.h>
11
12#include <memory>
13#include <vector>
14
15#include "core/fxcrt/fx_coordinates.h"
16#include "core/fxcrt/unowned_ptr.h"
17#include "core/fxcrt/widestring.h"
18#include "third_party/abseil-cpp/absl/types/optional.h"
19
20class CPDF_TextPage;
21
23 public:
24 struct Options {
25 bool bMatchCase = false;
26 bool bMatchWholeWord = false;
27 bool bConsecutive = false;
28 };
29
31 const CPDF_TextPage* pTextPage,
32 const WideString& findwhat,
33 const Options& options,
34 absl::optional<size_t> startPos);
35
37
38 bool FindNext();
39 bool FindPrev();
40 int GetCurOrder() const;
41 int GetMatchedCount() const;
42
43 private:
44 CPDF_TextPageFind(const CPDF_TextPage* pTextPage,
45 const std::vector<WideString>& findwhat_array,
46 const Options& options,
47 absl::optional<size_t> startPos);
48
49 // Should be called immediately after construction.
50 bool FindFirst();
51
52 int GetCharIndex(int index) const;
53
54 UnownedPtr<const CPDF_TextPage> const m_pTextPage;
55 const WideString m_strText;
56 const std::vector<WideString> m_csFindWhatArray;
57 absl::optional<size_t> m_findNextStart;
58 absl::optional<size_t> m_findPreStart;
59 int m_resStart = 0;
60 int m_resEnd = -1;
61 const Options m_options;
62};
63
64#endif // CORE_FPDFTEXT_CPDF_TEXTPAGEFIND_H_
static std::unique_ptr< CPDF_TextPageFind > Create(const CPDF_TextPage *pTextPage, const WideString &findwhat, const Options &options, absl::optional< size_t > startPos)
CharType operator[](const size_t index) const
Definition widestring.h:146
bool IsEmpty() const
Definition widestring.h:118
CharType Back() const
Definition widestring.h:152
bool FXSYS_IsDecimalDigit(wchar_t c)
constexpr wchar_t kRightSingleQuotationMark
Definition fx_unicode.h:99