Home | History | Annotate | Download | only in fde
      1 // Copyright 2014 PDFium Authors. All rights reserved.
      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 XFA_FDE_CFX_WORDBREAK_H_
      8 #define XFA_FDE_CFX_WORDBREAK_H_
      9 
     10 #include <memory>
     11 
     12 #include "core/fxcrt/fx_string.h"
     13 #include "core/fxcrt/fx_system.h"
     14 
     15 class IFX_CharIter;
     16 
     17 class CFX_WordBreak {
     18  public:
     19   CFX_WordBreak();
     20   ~CFX_WordBreak();
     21 
     22   void Attach(IFX_CharIter* pIter);
     23   void Attach(const CFX_WideString& wsText);
     24   bool Next(bool bPrev);
     25   void SetAt(int32_t nIndex);
     26   int32_t GetWordPos() const;
     27   int32_t GetWordLength() const;
     28   void GetWord(CFX_WideString& wsWord) const;
     29   bool IsEOF(bool bTail) const;
     30 
     31  protected:
     32   bool FindNextBreakPos(IFX_CharIter* pIter, bool bPrev, bool bFromNext = true);
     33 
     34  private:
     35   std::unique_ptr<IFX_CharIter> m_pPreIter;
     36   std::unique_ptr<IFX_CharIter> m_pCurIter;
     37 };
     38 
     39 #endif  // XFA_FDE_CFX_WORDBREAK_H_
     40