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

Side by Side Diff: xfa/fee/fde_txtedtbuf.h

Issue 1927973003: Remove IFDE_TxtEdt interfaces where possible. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « xfa.gyp ('k') | xfa/fee/fde_txtedtbuf.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef XFA_FEE_FDE_TXTEDTBUF_H_ 7 #ifndef XFA_FEE_FDE_TXTEDTBUF_H_
8 #define XFA_FEE_FDE_TXTEDTBUF_H_ 8 #define XFA_FEE_FDE_TXTEDTBUF_H_
9 9
10 #include "xfa/fee/ifde_txtedtbuf.h"
11 #include "xfa/fee/ifde_txtedtengine.h" 10 #include "xfa/fee/ifde_txtedtengine.h"
12 #include "xfa/fgas/crt/fgas_memory.h" 11 #include "xfa/fgas/crt/fgas_memory.h"
13 12
14 class IFX_CharIter; 13 class IFX_CharIter;
15 class CFDE_TxtEdtBuf; 14 class CFDE_TxtEdtBuf;
16 15
17 class CFDE_TxtEdtBufIter : public IFX_CharIter { 16 class CFDE_TxtEdtBufIter : public IFX_CharIter {
18 public: 17 public:
19 CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias = 0); 18 CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias = 0);
20 19
21 virtual void Release(); 20 virtual void Release();
22 virtual FX_BOOL Next(FX_BOOL bPrev = FALSE); 21 virtual FX_BOOL Next(FX_BOOL bPrev = FALSE);
23 virtual FX_WCHAR GetChar(); 22 virtual FX_WCHAR GetChar();
24 virtual void SetAt(int32_t nIndex); 23 virtual void SetAt(int32_t nIndex);
25 virtual int32_t GetAt() const; 24 virtual int32_t GetAt() const;
26 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const; 25 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const;
27 virtual IFX_CharIter* Clone(); 26 virtual IFX_CharIter* Clone();
28 27
29 protected: 28 protected:
30 ~CFDE_TxtEdtBufIter(); 29 ~CFDE_TxtEdtBufIter();
31 30
32 private: 31 private:
33 CFDE_TxtEdtBuf* m_pBuf; 32 CFDE_TxtEdtBuf* m_pBuf;
34 int32_t m_nCurChunk; 33 int32_t m_nCurChunk;
35 int32_t m_nCurIndex; 34 int32_t m_nCurIndex;
36 int32_t m_nIndex; 35 int32_t m_nIndex;
37 FX_WCHAR m_Alias; 36 FX_WCHAR m_Alias;
38 }; 37 };
39 class CFDE_TxtEdtBuf : public IFDE_TxtEdtBuf { 38 class CFDE_TxtEdtBuf {
39 public:
40 CFDE_TxtEdtBuf();
41
42 void Release();
43 FX_BOOL SetChunkSize(int32_t nChunkSize);
44 int32_t GetChunkSize() const;
45 int32_t GetTextLength() const;
46 void SetText(const CFX_WideString& wsText);
47 void GetText(CFX_WideString& wsText) const;
48 FX_WCHAR GetCharByIndex(int32_t nIndex) const;
49 void GetRange(CFX_WideString& wsText,
50 int32_t nBegin,
51 int32_t nCount = -1) const;
52
53 void Insert(int32_t nPos, const FX_WCHAR* lpText, int32_t nLength = 1);
54 void Delete(int32_t nIndex, int32_t nLength = 1);
55 void Clear(FX_BOOL bRelease = TRUE);
56
57 FX_BOOL Optimize(IFX_Pause* pPause = nullptr);
58
59 protected:
60 ~CFDE_TxtEdtBuf();
61
62 private:
40 friend class CFDE_TxtEdtBufIter; 63 friend class CFDE_TxtEdtBufIter;
41 struct _FDE_CHUNKHEADER { 64
65 struct FDE_CHUNKHEADER {
42 int32_t nUsed; 66 int32_t nUsed;
43 FX_WCHAR wChars[1]; 67 FX_WCHAR wChars[1];
44 }; 68 };
45 typedef _FDE_CHUNKHEADER FDE_CHUNKHEADER; 69
46 typedef _FDE_CHUNKHEADER* FDE_LPCHUNKHEADER; 70 struct FDE_CHUNKPLACE {
47 struct _FDE_CHUNKPLACE {
48 int32_t nChunkIndex; 71 int32_t nChunkIndex;
49 int32_t nCharIndex; 72 int32_t nCharIndex;
50 }; 73 };
51 typedef _FDE_CHUNKPLACE FDE_CHUNKPLACE;
52 typedef _FDE_CHUNKPLACE* FDE_LPCHUNKPLACE;
53 74
54 public:
55 CFDE_TxtEdtBuf(int32_t nDefChunkSize = FDE_DEFCHUNKLENGTH);
56
57 virtual void Release();
58 virtual FX_BOOL SetChunkSize(int32_t nChunkSize);
59 virtual int32_t GetChunkSize() const;
60 virtual int32_t GetTextLength() const;
61 virtual void SetText(const CFX_WideString& wsText);
62 virtual void GetText(CFX_WideString& wsText) const;
63 virtual FX_WCHAR GetCharByIndex(int32_t nIndex) const;
64 virtual void GetRange(CFX_WideString& wsText,
65 int32_t nBegine,
66 int32_t nCount = -1) const;
67
68 virtual void Insert(int32_t nPos,
69 const FX_WCHAR* lpText,
70 int32_t nLength = 1);
71 virtual void Delete(int32_t nIndex, int32_t nLength = 1);
72 virtual void Clear(FX_BOOL bRelease = TRUE);
73
74 virtual FX_BOOL Optimize(IFX_Pause* pPause = NULL);
75
76 protected:
77 virtual ~CFDE_TxtEdtBuf();
78
79 private:
80 void ResetChunkBuffer(int32_t nDefChunkCount, int32_t nChunkSize); 75 void ResetChunkBuffer(int32_t nDefChunkCount, int32_t nChunkSize);
81 int32_t CP2Index(const FDE_CHUNKPLACE& cp) const; 76 int32_t CP2Index(const FDE_CHUNKPLACE& cp) const;
82 void Index2CP(int32_t nIndex, FDE_CHUNKPLACE& cp) const; 77 void Index2CP(int32_t nIndex, FDE_CHUNKPLACE& cp) const;
83 78
84 int32_t m_nChunkSize; 79 int32_t m_nChunkSize;
85 80
86 int32_t m_nTotal; 81 int32_t m_nTotal;
87 FX_BOOL m_bChanged; 82 FX_BOOL m_bChanged;
88 CFX_ArrayTemplate<FDE_CHUNKHEADER*> m_Chunks; 83 CFX_ArrayTemplate<FDE_CHUNKHEADER*> m_Chunks;
89 IFX_MEMAllocator* m_pAllocator; 84 IFX_MEMAllocator* m_pAllocator;
90 }; 85 };
91 86
92 #endif // XFA_FEE_FDE_TXTEDTBUF_H_ 87 #endif // XFA_FEE_FDE_TXTEDTBUF_H_
OLDNEW
« no previous file with comments | « xfa.gyp ('k') | xfa/fee/fde_txtedtbuf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698