Home | History | Annotate | Download | only in fxcrt
      1 // Copyright 2017 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 CORE_FXCRT_CFX_UTF8DECODER_H_
      8 #define CORE_FXCRT_CFX_UTF8DECODER_H_
      9 
     10 #include "core/fxcrt/cfx_widetextbuf.h"
     11 
     12 class CFX_UTF8Decoder {
     13  public:
     14   CFX_UTF8Decoder() { m_PendingBytes = 0; }
     15 
     16   void Clear();
     17   void Input(uint8_t byte);
     18   void AppendCodePoint(uint32_t ch);
     19   void ClearStatus() { m_PendingBytes = 0; }
     20   WideStringView GetResult() const { return m_Buffer.AsStringView(); }
     21 
     22  private:
     23   int m_PendingBytes;
     24   uint32_t m_PendingChar;
     25   CFX_WideTextBuf m_Buffer;
     26 };
     27 
     28 #endif  // CORE_FXCRT_CFX_UTF8DECODER_H_
     29