Magick++: CoderInfo.cpp Source File

Magick++ 7.1.0

CoderInfo.cpp
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 2001, 2002
4 //
5 // Copyright @ 2013 ImageMagick Studio LLC, a non-profit organization
6 // dedicated to making software imaging solutions freely available.
7 //
8 // CoderInfo implementation
9 //
10
11 #define MAGICKCORE_IMPLEMENTATION 1
12 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
13
14 #include "Magick++/Include.h"
15 #include "Magick++/CoderInfo.h"
16 #include "Magick++/Exception.h"
17
18 using namespace std;
19
20 Magick::CoderInfo::CoderInfo(void)
21 : _decoderThreadSupport(false),
22 _description(),
23 _encoderThreadSupport(false),
24 _isMultiFrame(false),
25 _isReadable(false),
26 _isWritable(false),
27 _mimeType(),
28 _module(),
29 _name()
30 {
31 }
32
33 Magick::CoderInfo::CoderInfo(const Magick::CoderInfo &coder_)
34 : _decoderThreadSupport(coder_._decoderThreadSupport),
35 _description(coder_._description),
36 _encoderThreadSupport(coder_._encoderThreadSupport),
37 _isMultiFrame(coder_._isMultiFrame),
38 _isReadable(coder_._isReadable),
39 _isWritable(coder_._isWritable),
40 _mimeType(coder_._mimeType),
41 _module(coder_._module),
42 _name(coder_._name)
43 {
44 }
45
46 Magick::CoderInfo::CoderInfo(const std::string &name_)
47 : _decoderThreadSupport(false),
48 _description(),
49 _encoderThreadSupport(false),
50 _isMultiFrame(false),
51 _isReadable(false),
52 _isWritable(false),
53 _mimeType(),
54 _module(),
55 _name()
56 {
57 const Magick::MagickInfo
58 *magickInfo;
59
60 GetPPException;
61 magickInfo=GetMagickInfo(name_.c_str(),exceptionInfo);
62 ThrowPPException(false);
63 if (magickInfo == 0)
64 throwExceptionExplicit(MagickCore::OptionError,"Coder not found",
65 name_.c_str());
66 else
67 {
68 _decoderThreadSupport=(GetMagickDecoderThreadSupport(magickInfo) ==
69 MagickTrue) ? true : false;
70 _description=std::string(magickInfo->description);
71 _encoderThreadSupport=(GetMagickEncoderThreadSupport(magickInfo) ==
72 MagickTrue) ? true : false;
73 _isMultiFrame=(GetMagickAdjoin(magickInfo) == MagickTrue) ? true : false;
74 _isReadable=((magickInfo->decoder == (MagickCore::DecodeImageHandler *)
75 NULL) ? false : true);
76 _isWritable=((magickInfo->encoder == (MagickCore::EncodeImageHandler *)
77 NULL) ? false : true);
78 _mimeType=std::string(magickInfo->mime_type != (char *) NULL ?
79 magickInfo->mime_type : "");
80 _module=std::string(magickInfo->magick_module);
81 _name=std::string(magickInfo->name);
82 }
83 }
84
85 Magick::CoderInfo::~CoderInfo(void)
86 {
87 }
88
89 Magick::CoderInfo& Magick::CoderInfo::operator=(const CoderInfo &coder_)
90 {
91 // If not being set to ourself
92 if (this != &coder_)
93 {
94 _decoderThreadSupport=coder_._decoderThreadSupport;
95 _description=coder_._description;
96 _encoderThreadSupport=coder_._encoderThreadSupport;
97 _isMultiFrame=coder_._isMultiFrame;
98 _isReadable=coder_._isReadable;
99 _isWritable=coder_._isWritable;
100 _mimeType=coder_._mimeType;
101 _module=coder_._module;
102 _name=coder_._name;
103 }
104 return(*this);
105 }
106
107 bool Magick::CoderInfo::canReadMultithreaded(void) const
108 {
109 return(_decoderThreadSupport);
110 }
111
112 bool Magick::CoderInfo::canWriteMultithreaded(void) const
113 {
114 return(_encoderThreadSupport);
115 }
116
117 std::string Magick::CoderInfo::description(void) const
118 {
119 return(_description);
120 }
121
122 bool Magick::CoderInfo::isReadable(void) const
123 {
124 return(_isReadable);
125 }
126
127 bool Magick::CoderInfo::isWritable(void) const
128 {
129 return(_isWritable);
130 }
131
132 bool Magick::CoderInfo::isMultiFrame(void) const
133 {
134 return(_isMultiFrame);
135 }
136
137 std::string Magick::CoderInfo::mimeType(void) const
138 {
139 return(_mimeType);
140 }
141
142 std::string Magick::CoderInfo::module(void) const
143 {
144 return(_module);
145 }
146
147 std::string Magick::CoderInfo::name(void) const
148 {
149 return(_name);
150 }
151
152 bool Magick::CoderInfo::unregister(void) const
153 {
154 return(UnregisterMagickInfo(_name.c_str()) != MagickFalse);
155 }
Magick::CoderInfo::CoderInfo
CoderInfo(void)
Definition: CoderInfo.cpp:20
Magick::CoderInfo::operator=
CoderInfo & operator=(const CoderInfo &coder_)
Definition: CoderInfo.cpp:89
Magick::CoderInfo::isReadable
bool isReadable(void) const
Definition: CoderInfo.cpp:122
CoderInfo.h
std
STL namespace.
Magick::CoderInfo::unregister
bool unregister(void) const
Definition: CoderInfo.cpp:152
Magick::CoderInfo::~CoderInfo
~CoderInfo(void)
Definition: CoderInfo.cpp:85
Magick::CoderInfo::canWriteMultithreaded
bool canWriteMultithreaded(void) const
Definition: CoderInfo.cpp:112
Magick::CoderInfo::isMultiFrame
bool isMultiFrame(void) const
Definition: CoderInfo.cpp:132
Magick::CoderInfo::description
std::string description(void) const
Definition: CoderInfo.cpp:117
Magick::throwExceptionExplicit
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:808
ThrowPPException
#define ThrowPPException(quiet)
Definition: Include.h:1580
Magick::CoderInfo::mimeType
std::string mimeType(void) const
Definition: CoderInfo.cpp:137
Magick::CoderInfo::module
std::string module(void) const
Definition: CoderInfo.cpp:142
Include.h
Magick::CoderInfo::isWritable
bool isWritable(void) const
Definition: CoderInfo.cpp:127
Magick::CoderInfo::canReadMultithreaded
bool canReadMultithreaded(void) const
Definition: CoderInfo.cpp:107
GetPPException
#define GetPPException
Definition: Include.h:1561
Magick::CoderInfo
Definition: CoderInfo.h:21
Exception.h
Magick::CoderInfo::name
std::string name(void) const
Definition: CoderInfo.cpp:147