diff options
Diffstat (limited to 'core/fxcrt/cfx_utf8decoder.h')
-rw-r--r-- | core/fxcrt/cfx_utf8decoder.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_utf8decoder.h b/core/fxcrt/cfx_utf8decoder.h new file mode 100644 index 0000000000..50c2a3966d --- /dev/null +++ b/core/fxcrt/cfx_utf8decoder.h @@ -0,0 +1,28 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXCRT_CFX_UTF8DECODER_H_ +#define CORE_FXCRT_CFX_UTF8DECODER_H_ + +#include "core/fxcrt/fx_basic.h" + +class CFX_UTF8Decoder { + public: + CFX_UTF8Decoder() { m_PendingBytes = 0; } + + void Clear(); + void Input(uint8_t byte); + void AppendCodePoint(uint32_t ch); + void ClearStatus() { m_PendingBytes = 0; } + CFX_WideStringC GetResult() const { return m_Buffer.AsStringC(); } + + private: + int m_PendingBytes; + uint32_t m_PendingChar; + CFX_WideTextBuf m_Buffer; +}; + +#endif // CORE_FXCRT_CFX_UTF8DECODER_H_ |