Merge to XFA: Use stdint.h types throughout PDFium.
[pdfium.git] / xfa / src / fee / src / fx_wordbreak / fx_wordbreak_impl.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FX_WORDBREAK_IMPL_H\r
8 #define _FX_WORDBREAK_IMPL_H\r
9 extern const FX_WORD gs_FX_WordBreak_Table[16];\r
10 extern const uint8_t gs_FX_WordBreak_CodePointProperties[(0xFFFF - 1) / 2 + 1];\r
11 enum FX_WordBreakProp {\r
12     FX_WordBreakProp_None               = 0     ,\r
13     FX_WordBreakProp_CR                         ,\r
14     FX_WordBreakProp_LF                         ,\r
15     FX_WordBreakProp_NewLine            ,\r
16     FX_WordBreakProp_Extend                     ,\r
17     FX_WordBreakProp_Format                     ,\r
18     FX_WordBreakProp_KataKana           ,\r
19     FX_WordBreakProp_ALetter            ,\r
20     FX_WordBreakProp_MidLetter          ,\r
21     FX_WordBreakProp_MidNum                     ,\r
22     FX_WordBreakProp_MidNumLet          ,\r
23     FX_WordBreakProp_Numberic           ,\r
24     FX_WordBreakProp_ExtendNumLet       ,\r
25 };\r
26 FX_WordBreakProp FX_GetWordBreakProperty(FX_WCHAR wcCodePoint);\r
27 class CFX_CharIter : public IFX_CharIter\r
28 {\r
29 public:\r
30     CFX_CharIter(const CFX_WideString & wsText);\r
31     virtual void                Release();\r
32     virtual FX_BOOL             Next(FX_BOOL bPrev = FALSE);\r
33     virtual FX_WCHAR    GetChar();\r
34     virtual void                SetAt(int32_t nIndex);\r
35     virtual int32_t     GetAt() const;\r
36     virtual FX_BOOL             IsEOF(FX_BOOL bTail = TRUE) const;\r
37     virtual IFX_CharIter * Clone();\r
38 protected:\r
39     ~CFX_CharIter();\r
40 private:\r
41     const CFX_WideString &m_wsText;\r
42     int32_t     m_nIndex;\r
43 };\r
44 class CFX_WordBreak : public IFX_WordBreak\r
45 {\r
46 public:\r
47     CFX_WordBreak();\r
48     virtual void                Release();\r
49     virtual void                Attach(IFX_CharIter * pIter);\r
50     virtual void                Attach(const CFX_WideString &wsText);\r
51     virtual FX_BOOL             Next(FX_BOOL bPrev);\r
52     virtual void                SetAt(int32_t nIndex);\r
53     virtual int32_t     GetWordPos() const;\r
54     virtual int32_t     GetWordLength() const;\r
55     virtual void                GetWord(CFX_WideString &wsWord) const;\r
56     virtual FX_BOOL             IsEOF(FX_BOOL bTail ) const;\r
57 protected:\r
58     ~CFX_WordBreak();\r
59     FX_BOOL FindNextBreakPos(IFX_CharIter * pIter, FX_BOOL bPrev, FX_BOOL bFromNext = TRUE);\r
60 private:\r
61     IFX_CharIter * m_pPreIter;\r
62     IFX_CharIter * m_pCurIter;\r
63 };\r
64 #endif\r