Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:45

0001 //========================================================================
0002 //
0003 // FileSpec.h
0004 //
0005 // All changes made under the Poppler project to this file are licensed
0006 // under GPL version 2 or later
0007 //
0008 // Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
0009 // Copyright (C) 2017-2019, 2021 Albert Astals Cid <aacid@kde.org>
0010 //
0011 // To see a description of the changes please see the Changelog file that
0012 // came with your tarball or type make ChangeLog if you are building from git
0013 //
0014 //========================================================================
0015 
0016 #ifndef FILE_SPEC_H
0017 #define FILE_SPEC_H
0018 
0019 #include "Object.h"
0020 #include "poppler_private_export.h"
0021 
0022 class POPPLER_PRIVATE_EXPORT EmbFile
0023 {
0024 public:
0025     explicit EmbFile(Object &&efStream);
0026     ~EmbFile();
0027 
0028     EmbFile(const EmbFile &) = delete;
0029     EmbFile &operator=(const EmbFile &) = delete;
0030 
0031     int size() const { return m_size; }
0032     const GooString *modDate() const { return m_modDate; }
0033     const GooString *createDate() const { return m_createDate; }
0034     const GooString *checksum() const { return m_checksum; }
0035     const GooString *mimeType() const { return m_mimetype; }
0036     Object *streamObject() { return &m_objStr; }
0037     Stream *stream() { return isOk() ? m_objStr.getStream() : nullptr; }
0038     bool isOk() const { return m_objStr.isStream(); }
0039     bool save(const char *path);
0040 
0041 private:
0042     bool save2(FILE *f);
0043 
0044     int m_size;
0045     GooString *m_createDate;
0046     GooString *m_modDate;
0047     GooString *m_checksum;
0048     GooString *m_mimetype;
0049     Object m_objStr;
0050 };
0051 
0052 class POPPLER_PRIVATE_EXPORT FileSpec
0053 {
0054 public:
0055     explicit FileSpec(const Object *fileSpec);
0056     ~FileSpec();
0057 
0058     FileSpec(const FileSpec &) = delete;
0059     FileSpec &operator=(const FileSpec &) = delete;
0060 
0061     bool isOk() const { return ok; }
0062 
0063     const GooString *getFileName() const { return fileName; }
0064     GooString *getFileNameForPlatform();
0065     const GooString *getDescription() const { return desc; }
0066     EmbFile *getEmbeddedFile();
0067 
0068     static Object newFileSpecObject(XRef *xref, GooFile *file, const std::string &fileName);
0069 
0070 private:
0071     bool ok;
0072 
0073     Object fileSpec;
0074 
0075     GooString *fileName; // F, UF, DOS, Mac, Unix
0076     GooString *platformFileName;
0077     Object fileStream; // Ref to F entry in UF
0078     EmbFile *embFile;
0079     GooString *desc; // Desc
0080 };
0081 
0082 Object getFileSpecName(const Object *fileSpec);
0083 Object POPPLER_PRIVATE_EXPORT getFileSpecNameForPlatform(const Object *fileSpec);
0084 
0085 #endif /* FILE_SPEC_H */