Home | History | Annotate | Download | only in fpdfdoc
      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/string_pool_template.h"
     12 #include "core/fxcrt/unowned_ptr.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(CPDF_Object* pObj);
     22   ~CPDF_FileSpec();
     23 
     24   // Convert a platform dependent file name into pdf format.
     25   static WideString EncodeFileName(const WideString& filepath);
     26 
     27   // Convert a pdf file name into platform dependent format.
     28   static WideString DecodeFileName(const WideString& filepath);
     29 
     30   CPDF_Object* GetObj() const { return m_pObj.Get(); }
     31   WideString GetFileName() const;
     32   CPDF_Stream* GetFileStream() const;
     33   CPDF_Dictionary* GetParamsDict() const;
     34 
     35   // Set this file spec to refer to a file name (not a url).
     36   void SetFileName(const WideString& wsFileName);
     37 
     38  private:
     39   UnownedPtr<CPDF_Object> const m_pObj;
     40 };
     41 
     42 #endif  // CORE_FPDFDOC_CPDF_FILESPEC_H_
     43