1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2013 Andreas Huggel <ahuggel@gmx.net>
4 *
5 * This program is part of the Exiv2 distribution.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
20 */
21/*!
22 @file epsimage.hpp
23 @brief EPS image.
24 <br>References:
25 <br>[1] <a href="http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf">Adobe PostScript Language Document Structuring Conventions Specification, Version 3.0</a>, September 1992
26 <br>[2] <a href="http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf">Adobe Encapsulated PostScript File Format Specification, Version 3.0</a>, May 1992
27 <br>[3] <a href="http://www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf">Adobe XMP Specification Part 3: Storage in Files</a>, July 2010
28 <br>[4] <a href="http://groups.google.com/group/adobe.illustrator.windows/msg/0a9d7b1244b59062">Re: Thumbnail data format in ai file</a>, Dec 2003
29 @version $Rev: $
30 @author Michael Ulbrich (mul)
31 <a href="mailto:mul@rentapacs.de">mul@rentapacs.de</a>
32 @author Volker Grabsch (vog)
33 <a href="mailto:vog@notjusthosting.com">vog@notjusthosting.com</a>
34 @date 7-Mar-2011, vog: created
35 */
36#ifndef EPSIMAGE_HPP_
37#define EPSIMAGE_HPP_
38
39// *****************************************************************************
40// included header files
41#include "image.hpp"
42#include "types.hpp"
43
44// + standard includes
45#include <string>
46
47// *****************************************************************************
48// namespace extensions
49namespace Exiv2
50{
51
52// *****************************************************************************
53// class definitions
54
55 // Add EPS to the supported image formats
56 namespace ImageType {
57 const int eps = 18; //!< EPS image type
58 }
59
60 /*!
61 @brief Class to access EPS images.
62 */
63 class EXIV2API EpsImage : public Image {
64 public:
65 //! @name Creators
66 //@{
67 /*!
68 @brief Constructor to open a EPS image. Since the
69 constructor can't return a result, callers should check the
70 good() method after object construction to determine success
71 or failure.
72 @param io An auto-pointer that owns a BasicIo instance used for
73 reading and writing image metadata. \b Important: The constructor
74 takes ownership of the passed in BasicIo instance through the
75 auto-pointer. Callers should not continue to use the BasicIo
76 instance after it is passed to this method. Use the Image::io()
77 method to get a temporary reference.
78 @param create Specifies if an existing image should be read (false)
79 or if a new file should be created (true).
80 */
81 EpsImage(BasicIo::AutoPtr io, bool create);
82 //@}
83
84 //! @name Manipulators
85 //@{
86 void readMetadata();
87 void writeMetadata();
88 /*!
89 @brief Not supported.
90 Calling this function will throw an instance of Error(32).
91 */
92 void setComment(const std::string& comment);
93 //@}
94
95 //! @name Accessors
96 //@{
97 std::string mimeType() const;
98 //@}
99
100 private:
101 //! @name NOT Implemented
102 //@{
103 //! Copy constructor
104 EpsImage(const EpsImage& rhs);
105 //! Assignment operator
106 EpsImage& operator=(const EpsImage& rhs);
107 //@}
108
109 }; // class EpsImage
110
111// *****************************************************************************
112// template, inline and free functions
113
114 // These could be static private functions on Image subclasses but then
115 // ImageFactory needs to be made a friend.
116 /*!
117 @brief Create a new EpsImage instance and return an auto-pointer to it.
118 Caller owns the returned object and the auto-pointer ensures that
119 it will be deleted.
120 */
121 EXIV2API Image::AutoPtr newEpsInstance(BasicIo::AutoPtr io, bool create);
122
123 //! Check if the file iIo is a EPS image.
124 EXIV2API bool isEpsType(BasicIo& iIo, bool advance);
125
126} // namespace Exiv2
127
128#endif // #ifndef EPSIMAGE_HPP_
129