blob: 63edbf6167f5d908274f90003c02487e43e51c01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// 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 XFA_FDE_CFDE_TXTEDTBUF_H_
#define XFA_FDE_CFDE_TXTEDTBUF_H_
#include <memory>
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_system.h"
class IFX_MemoryAllocator;
class IFX_Pause;
class CFDE_TxtEdtBuf {
public:
CFDE_TxtEdtBuf();
~CFDE_TxtEdtBuf();
int32_t GetChunkSize() const;
int32_t GetTextLength() const;
void SetText(const CFX_WideString& wsText);
CFX_WideString GetText() const;
FX_WCHAR GetCharByIndex(int32_t nIndex) const;
CFX_WideString GetRange(int32_t nBegin, int32_t nCount) const;
void Insert(int32_t nPos, const FX_WCHAR* lpText, int32_t nLength);
void Delete(int32_t nIndex, int32_t nLength);
void Clear(bool bRelease);
private:
friend class CFDE_TxtEdtBufIter;
friend class CFDE_TxtEdtBufTest;
struct FDE_CHUNKHEADER {
int32_t nUsed;
FX_WCHAR wChars[1];
};
struct FDE_CHUNKPLACE {
int32_t nChunkIndex;
int32_t nCharIndex;
};
void ResetChunkBuffer(int32_t nDefChunkCount, int32_t nChunkSize);
int32_t CP2Index(const FDE_CHUNKPLACE& cp) const;
void Index2CP(int32_t nIndex, FDE_CHUNKPLACE& cp) const;
void SetChunkSizeForTesting(size_t size);
int32_t m_nChunkSize;
int32_t m_nTotal;
bool m_bChanged;
CFX_ArrayTemplate<FDE_CHUNKHEADER*> m_Chunks;
std::unique_ptr<IFX_MemoryAllocator> m_pAllocator;
};
#endif // XFA_FDE_CFDE_TXTEDTBUF_H_
|