summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/extension.h
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-10-28 23:03:33 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-11-03 11:10:11 -0800
commitfdc00a7042d912aafaabddae4d9c84199921ef23 (patch)
tree32ab8ac91cc68d2cd15b9168782a71b3f3f5e7b9 /core/src/fxcrt/extension.h
parente9b38fa38de2c95d8260be31c57d9272c4d127ed (diff)
downloadpdfium-fdc00a7042d912aafaabddae4d9c84199921ef23.tar.xz
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
Diffstat (limited to 'core/src/fxcrt/extension.h')
-rw-r--r--core/src/fxcrt/extension.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index c23a2e3369..05aad67e40 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -26,6 +26,44 @@ public:
virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
};
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
+class CFX_CRTFileAccess : public IFX_FileAccess, public CFX_Object
+{
+public:
+ CFX_CRTFileAccess() : m_RefCount(0) {}
+
+ virtual void Release()
+ {
+ if (--m_RefCount == 0)
+ delete this;
+ }
+
+ IFX_FileAccess* Retain()
+ {
+ m_RefCount++;
+ return (IFX_FileAccess*)this;
+ }
+
+ virtual FX_BOOL Init(FX_WSTR wsPath)
+ {
+ m_path = wsPath;
+ m_RefCount = 1;
+ return TRUE;
+ }
+
+ virtual void GetPath(CFX_WideString& wsPath)
+ {
+ wsPath = m_path;
+ }
+
+ virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes)
+ {
+ return FX_CreateFileStream(m_path, dwModes);
+ }
+
+protected:
+ CFX_WideString m_path;
+ FX_DWORD m_RefCount;
+};
class CFX_CRTFileStream FX_FINAL : public IFX_FileStream, public CFX_Object
{
public: