xref: /aosp_15_r20/external/pdfium/core/fxcrt/css/cfx_cssinputtextbuf.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
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 CORE_FXCRT_CSS_CFX_CSSINPUTTEXTBUF_H_
8 #define CORE_FXCRT_CSS_CFX_CSSINPUTTEXTBUF_H_
9 
10 #include "core/fxcrt/widestring.h"
11 
12 class CFX_CSSInputTextBuf {
13  public:
14   explicit CFX_CSSInputTextBuf(WideStringView str);
15   ~CFX_CSSInputTextBuf();
16 
IsEOF()17   bool IsEOF() const { return m_iPos >= m_Buffer.GetLength(); }
MoveNext()18   void MoveNext() { m_iPos++; }
GetChar()19   wchar_t GetChar() const { return m_Buffer[m_iPos]; }
GetNextChar()20   wchar_t GetNextChar() const {
21     return m_iPos + 1 < m_Buffer.GetLength() ? m_Buffer[m_iPos + 1] : 0;
22   }
23 
24  protected:
25   const WideStringView m_Buffer;
26   size_t m_iPos = 0;
27 };
28 
29 #endif  // CORE_FXCRT_CSS_CFX_CSSINPUTTEXTBUF_H_
30