1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef _XFA_BASIC_IMP
8 #define _XFA_BASIC_IMP
9 typedef struct _XFA_NOTSUREATTRIBUTE {
10   XFA_ELEMENT eElement;
11   XFA_ATTRIBUTE eAttribute;
12   XFA_ATTRIBUTETYPE eType;
13   void* pValue;
14 } XFA_NOTSUREATTRIBUTE, *XFA_LPNOTSUREATTRIBUTE;
15 typedef XFA_NOTSUREATTRIBUTE const* XFA_LPCNOTSUREATTRIBUTE;
16 XFA_LPCNOTSUREATTRIBUTE XFA_GetNotsureAttribute(
17     XFA_ELEMENT eElement,
18     XFA_ATTRIBUTE eAttribute,
19     XFA_ATTRIBUTETYPE eType = XFA_ATTRIBUTETYPE_NOTSURE);
20 class CXFA_WideTextRead : public IFX_Stream {
21  public:
22   CXFA_WideTextRead(const CFX_WideString& wsBuffer);
23   virtual void Release();
24   virtual IFX_Stream* Retain();
25 
26   virtual FX_DWORD GetAccessModes() const;
27   virtual int32_t GetLength() const;
28   virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset);
29   virtual int32_t GetPosition();
30   virtual FX_BOOL IsEOF() const;
31 
ReadData(uint8_t * pBuffer,int32_t iBufferSize)32   virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) { return 0; }
33   virtual int32_t ReadString(FX_WCHAR* pStr,
34                              int32_t iMaxLength,
35                              FX_BOOL& bEOS,
36                              int32_t const* pByteSize = NULL);
WriteData(const uint8_t * pBuffer,int32_t iBufferSize)37   virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
38     return 0;
39   }
WriteString(const FX_WCHAR * pStr,int32_t iLength)40   virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) {
41     return 0;
42   }
Flush()43   virtual void Flush() {}
SetLength(int32_t iLength)44   virtual FX_BOOL SetLength(int32_t iLength) { return FALSE; }
45 
GetBOM(uint8_t bom[4])46   virtual int32_t GetBOM(uint8_t bom[4]) const { return 0; }
47   virtual FX_WORD GetCodePage() const;
48   virtual FX_WORD SetCodePage(FX_WORD wCodePage);
49 
Lock()50   virtual void Lock() {}
Unlock()51   virtual void Unlock() {}
52 
CreateSharedStream(FX_DWORD dwAccess,int32_t iOffset,int32_t iLength)53   virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess,
54                                          int32_t iOffset,
55                                          int32_t iLength) {
56     return NULL;
57   }
58 
GetSrcText()59   CFX_WideString GetSrcText() const { return m_wsBuffer; }
60 
61  protected:
62   CFX_WideString m_wsBuffer;
63   int32_t m_iPosition;
64   int32_t m_iRefCount;
65 };
66 #endif
67