Magick++  7.0.8
Convert, Edit, Or Compose Bitmap Images
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 // Copyright Dirk Lemstra 2013-2015
5 //
6 // CoderInfo implementation
7 //
8 
9 #define MAGICKCORE_IMPLEMENTATION 1
10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
11 
12 #include "Magick++/Include.h"
13 #include "Magick++/CoderInfo.h"
14 #include "Magick++/Exception.h"
15 
16 using namespace std;
17 
19  : _decoderThreadSupport(false),
20  _description(),
21  _encoderThreadSupport(false),
22  _isMultiFrame(false),
23  _isReadable(false),
24  _isWritable(false),
25  _mimeType(),
26  _module(),
27  _name()
28 {
29 }
30 
32  : _decoderThreadSupport(coder_._decoderThreadSupport),
33  _description(coder_._description),
34  _encoderThreadSupport(coder_._encoderThreadSupport),
35  _isMultiFrame(coder_._isMultiFrame),
36  _isReadable(coder_._isReadable),
37  _isWritable(coder_._isWritable),
38  _mimeType(coder_._mimeType),
39  _module(coder_._module),
40  _name(coder_._name)
41 {
42 }
43 
44 Magick::CoderInfo::CoderInfo(const std::string &name_)
45  : _decoderThreadSupport(false),
46  _description(),
47  _encoderThreadSupport(false),
48  _isMultiFrame(false),
49  _isReadable(false),
50  _isWritable(false),
51  _mimeType(),
52  _module(),
53  _name()
54 {
55  const Magick::MagickInfo
56  *magickInfo;
57 
59  magickInfo=GetMagickInfo(name_.c_str(),exceptionInfo);
60  ThrowPPException(false);
61  if (magickInfo == 0)
62  throwExceptionExplicit(MagickCore::OptionError,"Coder not found",
63  name_.c_str());
64  else
65  {
66  _decoderThreadSupport=(GetMagickDecoderThreadSupport(magickInfo) ==
67  MagickTrue) ? true : false;
68  _description=std::string(magickInfo->description);
69  _encoderThreadSupport=(GetMagickEncoderThreadSupport(magickInfo) ==
70  MagickTrue) ? true : false;
71  _isMultiFrame=(GetMagickAdjoin(magickInfo) == MagickTrue) ? true : false;
72  _isReadable=((magickInfo->decoder == (MagickCore::DecodeImageHandler *)
73  NULL) ? false : true);
74  _isWritable=((magickInfo->encoder == (MagickCore::EncodeImageHandler *)
75  NULL) ? false : true);
76  _mimeType=std::string(magickInfo->mime_type != (char *) NULL ?
77  magickInfo->mime_type : "");
78  _module=std::string(magickInfo->module);
79  _name=std::string(magickInfo->name);
80  }
81 }
82 
84 {
85 }
86 
88 {
89  // If not being set to ourself
90  if (this != &coder_)
91  {
92  _decoderThreadSupport=coder_._decoderThreadSupport;
93  _description=coder_._description;
94  _encoderThreadSupport=coder_._encoderThreadSupport;
95  _isMultiFrame=coder_._isMultiFrame;
96  _isReadable=coder_._isReadable;
97  _isWritable=coder_._isWritable;
98  _mimeType=coder_._mimeType;
99  _module=coder_._module;
100  _name=coder_._name;
101  }
102  return(*this);
103 }
104 
106 {
107  return(_decoderThreadSupport);
108 }
109 
111 {
112  return(_encoderThreadSupport);
113 }
114 
115 std::string Magick::CoderInfo::description(void) const
116 {
117  return(_description);
118 }
119 
121 {
122  return(_isReadable);
123 }
124 
126 {
127  return(_isWritable);
128 }
129 
131 {
132  return(_isMultiFrame);
133 }
134 
135 std::string Magick::CoderInfo::mimeType(void) const
136 {
137  return(_mimeType);
138 }
139 
140 std::string Magick::CoderInfo::module(void) const
141 {
142  return(_module);
143 }
144 
145 std::string Magick::CoderInfo::name(void) const
146 {
147  return(_name);
148 }
149 
151 {
152  return(UnregisterMagickInfo(_name.c_str()) != MagickFalse);
153 }
CoderInfo & operator=(const CoderInfo &coder_)
Definition: CoderInfo.cpp:87
bool isReadable(void) const
Definition: CoderInfo.cpp:120
STL namespace.
bool unregister(void) const
Definition: CoderInfo.cpp:150
bool canWriteMultithreaded(void) const
Definition: CoderInfo.cpp:110
bool isMultiFrame(void) const
Definition: CoderInfo.cpp:130
std::string description(void) const
Definition: CoderInfo.cpp:115
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:806
#define ThrowPPException(quiet)
Definition: Include.h:1540
std::string mimeType(void) const
Definition: CoderInfo.cpp:135
std::string module(void) const
Definition: CoderInfo.cpp:140
bool isWritable(void) const
Definition: CoderInfo.cpp:125
bool canReadMultithreaded(void) const
Definition: CoderInfo.cpp:105
#define GetPPException
Definition: Include.h:1521
std::string name(void) const
Definition: CoderInfo.cpp:145