OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/cxfa_widetextread.h" | 7 #include "xfa/fxfa/parser/cxfa_widetextread.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "core/fxcrt/fx_ext.h" | 11 #include "core/fxcrt/fx_ext.h" |
12 #include "xfa/fgas/crt/fgas_codepage.h" | 12 #include "xfa/fgas/crt/fgas_codepage.h" |
13 | 13 |
14 CXFA_WideTextRead::CXFA_WideTextRead(const CFX_WideString& wsBuffer) | 14 CXFA_WideTextRead::CXFA_WideTextRead(const CFX_WideString& wsBuffer) |
15 : m_wsBuffer(wsBuffer), m_iPosition(0), m_iRefCount(1) {} | 15 : m_wsBuffer(wsBuffer), m_iPosition(0), m_iRefCount(1) {} |
16 | 16 |
17 void CXFA_WideTextRead::Release() { | 17 void CXFA_WideTextRead::Release() { |
18 if (--m_iRefCount < 1) | 18 if (--m_iRefCount < 1) |
19 delete this; | 19 delete this; |
20 } | 20 } |
21 | 21 |
22 IFX_Stream* CXFA_WideTextRead::Retain() { | 22 IFGAS_Stream* CXFA_WideTextRead::Retain() { |
23 m_iRefCount++; | 23 m_iRefCount++; |
24 return this; | 24 return this; |
25 } | 25 } |
26 | 26 |
27 uint32_t CXFA_WideTextRead::GetAccessModes() const { | 27 uint32_t CXFA_WideTextRead::GetAccessModes() const { |
28 return FX_STREAMACCESS_Read | FX_STREAMACCESS_Text; | 28 return FX_STREAMACCESS_Read | FX_STREAMACCESS_Text; |
29 } | 29 } |
30 | 30 |
31 int32_t CXFA_WideTextRead::GetLength() const { | 31 int32_t CXFA_WideTextRead::GetLength() const { |
32 return m_wsBuffer.GetLength() * sizeof(FX_WCHAR); | 32 return m_wsBuffer.GetLength() * sizeof(FX_WCHAR); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 uint16_t CXFA_WideTextRead::GetCodePage() const { | 93 uint16_t CXFA_WideTextRead::GetCodePage() const { |
94 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; | 94 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; |
95 } | 95 } |
96 | 96 |
97 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { | 97 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { |
98 return GetCodePage(); | 98 return GetCodePage(); |
99 } | 99 } |
100 | 100 |
101 IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, | 101 IFGAS_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, |
102 int32_t iOffset, | 102 int32_t iOffset, |
103 int32_t iLength) { | 103 int32_t iLength) { |
104 return nullptr; | 104 return nullptr; |
105 } | 105 } |
106 | 106 |
107 CFX_WideString CXFA_WideTextRead::GetSrcText() const { | 107 CFX_WideString CXFA_WideTextRead::GetSrcText() const { |
108 return m_wsBuffer; | 108 return m_wsBuffer; |
109 } | 109 } |
OLD | NEW |