1 // Copyright 2016 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 CORE_FPDFDOC_CPDF_FILESPEC_H_ 8 #define CORE_FPDFDOC_CPDF_FILESPEC_H_ 9 10 #include "core/fxcrt/fx_string.h" 11 #include "core/fxcrt/retain_ptr.h" 12 #include "core/fxcrt/string_pool_template.h" 13 #include "core/fxcrt/weak_ptr.h" 14 15 class CPDF_Dictionary; 16 class CPDF_Object; 17 class CPDF_Stream; 18 19 class CPDF_FileSpec { 20 public: 21 explicit CPDF_FileSpec(const CPDF_Object* pObj); 22 explicit CPDF_FileSpec(CPDF_Object* pObj); 23 ~CPDF_FileSpec(); 24 25 // Convert a platform dependent file name into pdf format. 26 static WideString EncodeFileName(const WideString& filepath); 27 28 // Convert a pdf file name into platform dependent format. 29 static WideString DecodeFileName(const WideString& filepath); 30 GetObj()31 const CPDF_Object* GetObj() const { return m_pObj.Get(); } GetObj()32 CPDF_Object* GetObj() { return m_pWritableObj.Get(); } 33 WideString GetFileName() const; 34 const CPDF_Stream* GetFileStream() const; 35 CPDF_Stream* GetFileStream(); 36 const CPDF_Dictionary* GetParamsDict() const; 37 CPDF_Dictionary* GetParamsDict(); 38 39 // Set this file spec to refer to a file name (not a url). 40 void SetFileName(const WideString& wsFileName); 41 42 private: 43 RetainPtr<const CPDF_Object> const m_pObj; 44 RetainPtr<CPDF_Object> const m_pWritableObj; 45 }; 46 47 #endif // CORE_FPDFDOC_CPDF_FILESPEC_H_ 48