summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_widetextread.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-12 13:29:37 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-12 17:52:56 +0000
commit51114964fdb2a98f763318ce9affca906ed079e3 (patch)
tree0b5499f30ab34cd1f4f37b5368a766e57eca678a /xfa/fxfa/parser/cxfa_widetextread.cpp
parent661fcc0156b78fd40937c0844034605f430b94c6 (diff)
downloadpdfium-51114964fdb2a98f763318ce9affca906ed079e3.tar.xz
Fold CXFA_WideTextRead into IFGAS_Stream
This Cl moves CXFA_WideTextRead to be in the anonymous namespace of IFGAS_Stream and adds a IFGAS_Stream::CreateWideStringReadStream() method. This is done so we have all the implementations of IFGAS_Stream centralized. Change-Id: I9fbbf0a493fc2dd05fcd544e344268214a75d8a1 Reviewed-on: https://pdfium-review.googlesource.com/4052 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_widetextread.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_widetextread.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/xfa/fxfa/parser/cxfa_widetextread.cpp b/xfa/fxfa/parser/cxfa_widetextread.cpp
deleted file mode 100644
index dc210d1828..0000000000
--- a/xfa/fxfa/parser/cxfa_widetextread.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2016 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
-
-#include "xfa/fxfa/parser/cxfa_widetextread.h"
-
-#include <algorithm>
-
-#include "core/fxcrt/fx_ext.h"
-#include "third_party/base/stl_util.h"
-#include "xfa/fgas/crt/fgas_codepage.h"
-
-CXFA_WideTextRead::CXFA_WideTextRead(const CFX_WideString& wsBuffer)
- : m_wsBuffer(wsBuffer), m_iPosition(0) {}
-
-CXFA_WideTextRead::~CXFA_WideTextRead() {}
-
-uint32_t CXFA_WideTextRead::GetAccessModes() const {
- return 0;
-}
-
-int32_t CXFA_WideTextRead::GetLength() const {
- return m_wsBuffer.GetLength() * sizeof(wchar_t);
-}
-
-int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
- switch (eSeek) {
- case FX_STREAMSEEK_Begin:
- m_iPosition = iOffset;
- break;
- case FX_STREAMSEEK_Current:
- m_iPosition += iOffset;
- break;
- case FX_STREAMSEEK_End:
- m_iPosition = m_wsBuffer.GetLength() + iOffset;
- break;
- }
- m_iPosition = pdfium::clamp(0, m_iPosition, m_wsBuffer.GetLength());
- return GetPosition();
-}
-
-int32_t CXFA_WideTextRead::GetPosition() {
- return m_iPosition * sizeof(wchar_t);
-}
-
-bool CXFA_WideTextRead::IsEOF() const {
- return m_iPosition >= m_wsBuffer.GetLength();
-}
-
-int32_t CXFA_WideTextRead::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
- return 0;
-}
-
-int32_t CXFA_WideTextRead::ReadString(wchar_t* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
- iMaxLength = std::min(iMaxLength, m_wsBuffer.GetLength() - m_iPosition);
- if (iMaxLength == 0)
- return 0;
-
- FXSYS_wcsncpy(pStr, m_wsBuffer.c_str() + m_iPosition, iMaxLength);
- m_iPosition += iMaxLength;
- bEOS = IsEOF();
- return iMaxLength;
-}
-
-int32_t CXFA_WideTextRead::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
- return 0;
-}
-
-int32_t CXFA_WideTextRead::WriteString(const wchar_t* pStr, int32_t iLength) {
- return 0;
-}
-
-bool CXFA_WideTextRead::SetLength(int32_t iLength) {
- return false;
-}
-
-int32_t CXFA_WideTextRead::GetBOM(uint8_t bom[4]) const {
- return 0;
-}
-
-uint16_t CXFA_WideTextRead::GetCodePage() const {
- return (sizeof(wchar_t) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE;
-}
-
-uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) {
- return GetCodePage();
-}
-
-CFX_WideString CXFA_WideTextRead::GetSrcText() const {
- return m_wsBuffer;
-}