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_CFX_UTF8DECODER_H_ 8 #define CORE_FXCRT_CFX_UTF8DECODER_H_ 9 10 #include "core/fxcrt/string_view_template.h" 11 #include "core/fxcrt/widestring.h" 12 13 class CFX_UTF8Decoder { 14 public: 15 explicit CFX_UTF8Decoder(ByteStringView input); 16 ~CFX_UTF8Decoder(); 17 18 WideString TakeResult(); 19 20 private: 21 void ProcessByte(uint8_t byte); 22 void AppendCodePoint(uint32_t ch); 23 24 int m_PendingBytes = 0; 25 uint32_t m_PendingChar = 0; 26 WideString m_Buffer; 27 }; 28 29 #endif // CORE_FXCRT_CFX_UTF8DECODER_H_ 30