OLD | NEW |
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_FX_WORDBREAK_FX_WORDBREAK_H_ | 7 #ifndef XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_H_ |
8 #define XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_H_ | 8 #define XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_string.h" | 10 #include "core/fxcrt/include/fx_string.h" |
11 #include "core/fxcrt/include/fx_system.h" | 11 #include "core/fxcrt/include/fx_system.h" |
| 12 #include "xfa/fee/ifde_txtedtengine.h" |
12 | 13 |
13 class IFX_CharIter; | 14 class CFX_CharIter : public IFX_CharIter { |
| 15 public: |
| 16 CFX_CharIter(const CFX_WideString& wsText); |
| 17 virtual void Release(); |
| 18 virtual FX_BOOL Next(FX_BOOL bPrev = FALSE); |
| 19 virtual FX_WCHAR GetChar(); |
| 20 virtual void SetAt(int32_t nIndex); |
| 21 virtual int32_t GetAt() const; |
| 22 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const; |
| 23 virtual IFX_CharIter* Clone(); |
14 | 24 |
15 class IFX_WordBreak { | 25 protected: |
| 26 ~CFX_CharIter(); |
| 27 |
| 28 private: |
| 29 const CFX_WideString& m_wsText; |
| 30 int32_t m_nIndex; |
| 31 }; |
| 32 class CFX_WordBreak { |
16 public: | 33 public: |
17 virtual ~IFX_WordBreak() {} | 34 CFX_WordBreak(); |
18 virtual void Release() = 0; | 35 |
19 virtual void Attach(IFX_CharIter* pIter) = 0; | 36 void Release(); |
20 virtual void Attach(const CFX_WideString& wsText) = 0; | 37 void Attach(IFX_CharIter* pIter); |
21 virtual FX_BOOL Next(FX_BOOL bPrev) = 0; | 38 void Attach(const CFX_WideString& wsText); |
22 virtual void SetAt(int32_t nIndex) = 0; | 39 FX_BOOL Next(FX_BOOL bPrev); |
23 virtual int32_t GetWordPos() const = 0; | 40 void SetAt(int32_t nIndex); |
24 virtual int32_t GetWordLength() const = 0; | 41 int32_t GetWordPos() const; |
25 virtual void GetWord(CFX_WideString& wsWord) const = 0; | 42 int32_t GetWordLength() const; |
26 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const = 0; | 43 void GetWord(CFX_WideString& wsWord) const; |
| 44 FX_BOOL IsEOF(FX_BOOL bTail) const; |
| 45 |
| 46 protected: |
| 47 ~CFX_WordBreak(); |
| 48 FX_BOOL FindNextBreakPos(IFX_CharIter* pIter, |
| 49 FX_BOOL bPrev, |
| 50 FX_BOOL bFromNext = TRUE); |
| 51 |
| 52 private: |
| 53 IFX_CharIter* m_pPreIter; |
| 54 IFX_CharIter* m_pCurIter; |
27 }; | 55 }; |
28 IFX_WordBreak* FX_WordBreak_Create(); | |
29 | 56 |
30 #endif // XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_H_ | 57 #endif // XFA_FEE_FX_WORDBREAK_FX_WORDBREAK_H_ |
OLD | NEW |