From 1337cbf8dbaa3fff936af3fc1dd67e7ba3481a41 Mon Sep 17 00:00:00 2001 From: dirk Date: Wed, 4 Sep 2013 16:03:23 +0000 Subject: [PATCH] Added mime type property to CoderInfo. --- Magick++/lib/CoderInfo.cpp | 29 ++++++++++++++++++-------- Magick++/lib/Magick++/CoderInfo.h | 34 +++++++++++++++++-------------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/Magick++/lib/CoderInfo.cpp b/Magick++/lib/CoderInfo.cpp index 9d085566f..5f68234fe 100644 --- a/Magick++/lib/CoderInfo.cpp +++ b/Magick++/lib/CoderInfo.cpp @@ -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) diff --git a/Magick++/lib/Magick++/CoderInfo.h b/Magick++/lib/Magick++/CoderInfo.h index 5e8b580d2..77b801dfc 100644 --- a/Magick++/lib/Magick++/CoderInfo.h +++ b/Magick++/lib/Magick++/CoderInfo.h @@ -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 -- 2.50.1