summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_utf8decoder.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-30 16:13:01 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-30 20:47:28 +0000
commit5624fe39db570f5ad0fab80cf6314e95e4397698 (patch)
treefd662cadd3d77d7fb286abe33d0ff653773a5136 /core/fxcrt/cfx_utf8decoder.h
parentc2f0789bf90d8f3656abde8da8371e8975f7084e (diff)
downloadpdfium-5624fe39db570f5ad0fab80cf6314e95e4397698.tar.xz
Move CFX_UTF8Decoder out of fx_basic
This CL moves CFX_UTF8Decoder out of fx_basic and includes where needed. Change-Id: I1a093a8a77bbefcc90fbb2f81b1da65bfc0512bf Reviewed-on: https://pdfium-review.googlesource.com/12411 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_utf8decoder.h')
-rw-r--r--core/fxcrt/cfx_utf8decoder.h28
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_