diff options
author | Wei Li <weili@chromium.org> | 2016-02-18 14:04:57 -0800 |
---|---|---|
committer | Wei Li <weili@chromium.org> | 2016-02-18 14:04:57 -0800 |
commit | 65b3655fc3f858180122399654bf29dc5d11a4ba (patch) | |
tree | 6716bbab3ac319ae7677c0c52e6a8839decd6316 /core/include/fpdfdoc | |
parent | 4422dbd49b949a7019294e91edac96c761430e71 (diff) | |
download | pdfium-65b3655fc3f858180122399654bf29dc5d11a4ba.tar.xz |
Clean up CPDF_FileSpec and add unit tests
Change implicit conversion to accessor function, remove unused function
and unused parameter, add a couple checks for null pointers, and some
cleanup.
BUG=pdfium:247
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1703183002 .
Diffstat (limited to 'core/include/fpdfdoc')
-rw-r--r-- | core/include/fpdfdoc/fpdf_doc.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 17f2c824c6..15616be4d5 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -317,21 +317,23 @@ class CPDF_DocJSActions { protected: CPDF_Document* const m_pDocument; }; + class CPDF_FileSpec { public: CPDF_FileSpec(); - explicit CPDF_FileSpec(CPDF_Object* pObj) { m_pObj = pObj; } - operator CPDF_Object*() const { return m_pObj; } - - FX_BOOL IsURL() const; + // Convert a platform dependent file name into pdf format. + static CFX_WideString EncodeFileName(const CFX_WideStringC& filepath); - FX_BOOL GetFileName(CFX_WideString& wsFileName) const; + // Convert a pdf file name into platform dependent format. + static CFX_WideString DecodeFileName(const CFX_WideStringC& filepath); - CPDF_Stream* GetFileStream() const; + CPDF_Object* GetObj() const { return m_pObj; } + bool GetFileName(CFX_WideString* wsFileName) const; - void SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL = FALSE); + // Set this file spec to refer to a file name (not a url). + void SetFileName(const CFX_WideStringC& wsFileName); protected: CPDF_Object* m_pObj; |