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) {} |
16 | |
17 void CXFA_WideTextRead::Release() { | |
18 if (--m_iRefCount < 1) | |
19 delete this; | |
20 } | |
21 | |
22 IFGAS_Stream* CXFA_WideTextRead::Retain() { | |
23 m_iRefCount++; | |
24 return this; | |
25 } | |
26 | 16 |
27 uint32_t CXFA_WideTextRead::GetAccessModes() const { | 17 uint32_t CXFA_WideTextRead::GetAccessModes() const { |
28 return FX_STREAMACCESS_Read | FX_STREAMACCESS_Text; | 18 return FX_STREAMACCESS_Read | FX_STREAMACCESS_Text; |
29 } | 19 } |
30 | 20 |
31 int32_t CXFA_WideTextRead::GetLength() const { | 21 int32_t CXFA_WideTextRead::GetLength() const { |
32 return m_wsBuffer.GetLength() * sizeof(FX_WCHAR); | 22 return m_wsBuffer.GetLength() * sizeof(FX_WCHAR); |
33 } | 23 } |
34 | 24 |
35 int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { | 25 int32_t CXFA_WideTextRead::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 81 } |
92 | 82 |
93 uint16_t CXFA_WideTextRead::GetCodePage() const { | 83 uint16_t CXFA_WideTextRead::GetCodePage() const { |
94 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; | 84 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; |
95 } | 85 } |
96 | 86 |
97 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { | 87 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { |
98 return GetCodePage(); | 88 return GetCodePage(); |
99 } | 89 } |
100 | 90 |
101 IFGAS_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, | 91 CFX_RetainPtr<IFGAS_Stream> CXFA_WideTextRead::CreateSharedStream( |
102 int32_t iOffset, | 92 uint32_t dwAccess, |
103 int32_t iLength) { | 93 int32_t iOffset, |
| 94 int32_t iLength) { |
104 return nullptr; | 95 return nullptr; |
105 } | 96 } |
106 | 97 |
107 CFX_WideString CXFA_WideTextRead::GetSrcText() const { | 98 CFX_WideString CXFA_WideTextRead::GetSrcText() const { |
108 return m_wsBuffer; | 99 return m_wsBuffer; |
109 } | 100 } |
OLD | NEW |