Commit fb8ea4d1 authored by dirk's avatar dirk

Added mime type property to CoderInfo.

parent f413279a
......@@ -18,6 +18,7 @@ using namespace std;
Magick::CoderInfo::CoderInfo ( void )
: _name(),
_description(),
_mimeType(),
_isReadable(false),
_isWritable(false),
_isMultiFrame(false)
......@@ -29,6 +30,7 @@ Magick::CoderInfo::CoderInfo ( const Magick::CoderInfo &coder_ )
{
_name = coder_._name;
_description = coder_._description;
_mimeType = coder_._mimeType;
_isReadable = coder_._isReadable;
_isWritable = coder_._isWritable;
_isMultiFrame = coder_._isMultiFrame;
......@@ -37,13 +39,15 @@ Magick::CoderInfo::CoderInfo ( const Magick::CoderInfo &coder_ )
Magick::CoderInfo::CoderInfo ( const std::string &name_ )
: _name(),
_description(),
_mimeType(),
_isReadable(false),
_isWritable(false),
_isMultiFrame(false)
{
ExceptionInfo exceptionInfo;
GetExceptionInfo( &exceptionInfo );
const Magick::MagickInfo *magickInfo = GetMagickInfo( name_.c_str(), &exceptionInfo );
const Magick::MagickInfo *magickInfo = GetMagickInfo( name_.c_str(),
&exceptionInfo );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
if( magickInfo == 0 )
......@@ -54,6 +58,7 @@ Magick::CoderInfo::CoderInfo ( const std::string &name_ )
{
_name = string(magickInfo->name);
_description = string(magickInfo->description);
_mimeType = string(magickInfo->mime_type);
_isReadable = ((magickInfo->decoder == 0) ? false : true);
_isWritable = ((magickInfo->encoder == 0) ? false : true);
_isMultiFrame = ((magickInfo->adjoin == 0) ? false : true);
......@@ -65,12 +70,6 @@ Magick::CoderInfo::~CoderInfo ( void )
// Nothing to do
}
// Format name
std::string Magick::CoderInfo::name( void ) const
{
return _name;
}
// Format description
std::string Magick::CoderInfo::description( void ) const
{
......@@ -95,14 +94,27 @@ bool Magick::CoderInfo::isMultiFrame( void ) const
return _isMultiFrame;
}
// Format mime type
std::string Magick::CoderInfo::mimeType( void ) const
{
return _mimeType;
}
// Format name
std::string Magick::CoderInfo::name( void ) const
{
return _name;
}
// Assignment operator
Magick::CoderInfo& Magick::CoderInfo::operator= (const CoderInfo &coder_ )
Magick::CoderInfo& Magick::CoderInfo::operator= ( const CoderInfo &coder_ )
{
// If not being set to ourself
if (this != &coder_)
{
_name = coder_._name;
_description = coder_._description;
_mimeType = coder_._mimeType;
_isReadable = coder_._isReadable;
_isWritable = coder_._isWritable;
_isMultiFrame = coder_._isMultiFrame;
......@@ -114,6 +126,7 @@ Magick::CoderInfo& Magick::CoderInfo::operator= (const CoderInfo &coder_ )
Magick::CoderInfo::CoderInfo ( const MagickCore::MagickInfo *magickInfo_ )
: _name(string(magickInfo_->name ? magickInfo_->name : "")),
_description(string(magickInfo_->description ? magickInfo_->description : "")),
_mimeType(string(magickInfo_->mime_type ? magickInfo_->mime_type : "")),
_isReadable(magickInfo_->decoder ? true : false),
_isWritable(magickInfo_->encoder ? true : false),
_isMultiFrame(magickInfo_->adjoin ? true : false)
......
......@@ -20,9 +20,9 @@ namespace Magick
public:
enum MatchType {
AnyMatch, // match any coder
TrueMatch, // match coder if true
FalseMatch // match coder if false
AnyMatch, // match any coder
TrueMatch, // match coder if true
FalseMatch // match coder if false
};
// Default constructor
......@@ -37,23 +37,26 @@ namespace Magick
// Destructor
~CoderInfo ( void );
// Format name
std::string name( void ) const;
// Format description
std::string description( void ) const;
// Format supports multiple frames
bool isMultiFrame( void ) const;
// Format is readable
bool isReadable( void ) const;
// Format is writeable
bool isWritable( void ) const;
// Format supports multiple frames
bool isMultiFrame( void ) const;
// Format mime type
std::string mimeType( void ) const;
// Format name
std::string name( void ) const;
// Assignment operator
CoderInfo& operator= (const CoderInfo &coder_ );
CoderInfo& operator= ( const CoderInfo &coder_ );
//
// Implemementation methods
......@@ -62,12 +65,13 @@ namespace Magick
private:
std::string _name;
std::string _description;
bool _isReadable;
bool _isWritable;
bool _isMultiFrame;
std::string _description;
bool _isReadable;
bool _isWritable;
bool _isMultiFrame;
std::string _mimeType;
std::string _name;
};
} // namespace Magick
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment