OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CORE_FXCRT_FX_BASIC_H_ | 7 #ifndef CORE_FXCRT_FX_BASIC_H_ |
8 #define CORE_FXCRT_FX_BASIC_H_ | 8 #define CORE_FXCRT_FX_BASIC_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
| 13 #include "core/fxcrt/cfx_retain_ptr.h" |
13 #include "core/fxcrt/fx_memory.h" | 14 #include "core/fxcrt/fx_memory.h" |
14 #include "core/fxcrt/fx_stream.h" | 15 #include "core/fxcrt/fx_stream.h" |
15 #include "core/fxcrt/fx_string.h" | 16 #include "core/fxcrt/fx_string.h" |
16 #include "core/fxcrt/fx_system.h" | 17 #include "core/fxcrt/fx_system.h" |
17 | 18 |
18 class CFX_BinaryBuf { | 19 class CFX_BinaryBuf { |
19 public: | 20 public: |
20 CFX_BinaryBuf(); | 21 CFX_BinaryBuf(); |
21 explicit CFX_BinaryBuf(FX_STRSIZE size); | 22 explicit CFX_BinaryBuf(FX_STRSIZE size); |
22 ~CFX_BinaryBuf(); | 23 ~CFX_BinaryBuf(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 public: | 113 public: |
113 CFX_FileBufferArchive(); | 114 CFX_FileBufferArchive(); |
114 ~CFX_FileBufferArchive(); | 115 ~CFX_FileBufferArchive(); |
115 | 116 |
116 void Clear(); | 117 void Clear(); |
117 bool Flush(); | 118 bool Flush(); |
118 int32_t AppendBlock(const void* pBuf, size_t size); | 119 int32_t AppendBlock(const void* pBuf, size_t size); |
119 int32_t AppendByte(uint8_t byte); | 120 int32_t AppendByte(uint8_t byte); |
120 int32_t AppendDWord(uint32_t i); | 121 int32_t AppendDWord(uint32_t i); |
121 int32_t AppendString(const CFX_ByteStringC& lpsz); | 122 int32_t AppendString(const CFX_ByteStringC& lpsz); |
122 | 123 void AttachFile(const CFX_RetainPtr<IFX_WriteStream>& pFile); |
123 // |pFile| must outlive the CFX_FileBufferArchive. | |
124 void AttachFile(IFX_WriteStream* pFile); | |
125 | 124 |
126 private: | 125 private: |
127 static const size_t kBufSize = 32768; | 126 static const size_t kBufSize = 32768; |
128 | 127 |
129 size_t m_Length; | 128 size_t m_Length; |
130 std::unique_ptr<uint8_t, FxFreeDeleter> m_pBuffer; | 129 std::unique_ptr<uint8_t, FxFreeDeleter> m_pBuffer; |
131 IFX_WriteStream* m_pFile; | 130 CFX_RetainPtr<IFX_WriteStream> m_pFile; |
132 }; | 131 }; |
133 | 132 |
134 class CFX_CharMap { | 133 class CFX_CharMap { |
135 public: | 134 public: |
136 static CFX_ByteString GetByteString(uint16_t codepage, | 135 static CFX_ByteString GetByteString(uint16_t codepage, |
137 const CFX_WideStringC& wstr); | 136 const CFX_WideStringC& wstr); |
138 | 137 |
139 static CFX_WideString GetWideString(uint16_t codepage, | 138 static CFX_WideString GetWideString(uint16_t codepage, |
140 const CFX_ByteStringC& bstr); | 139 const CFX_ByteStringC& bstr); |
141 | 140 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 FX_FLOAT e; | 848 FX_FLOAT e; |
850 FX_FLOAT f; | 849 FX_FLOAT f; |
851 FX_FLOAT g; | 850 FX_FLOAT g; |
852 FX_FLOAT h; | 851 FX_FLOAT h; |
853 FX_FLOAT i; | 852 FX_FLOAT i; |
854 }; | 853 }; |
855 | 854 |
856 uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits); | 855 uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits); |
857 | 856 |
858 #endif // CORE_FXCRT_FX_BASIC_H_ | 857 #endif // CORE_FXCRT_FX_BASIC_H_ |
OLD | NEW |