Changeset 575

Show
Ignore:
Timestamp:
12/19/07 11:34:36 (3 years ago)
Author:
artem
Message:

applied patch from Jochen (throw an exception if unknown type)

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/mapnik/image_util.hpp

    r570 r575  
    3838namespace mapnik { 
    3939     
     40    class ImageWriterException : public std::exception 
     41    { 
     42    private: 
     43        std::string message_; 
     44    public: 
     45        ImageWriterException(const std::string& message)  
     46            : message_(message) {} 
     47 
     48        ~ImageWriterException() throw() {} 
     49 
     50        virtual const char* what() const throw() 
     51        { 
     52            return message_.c_str(); 
     53        } 
     54    }; 
     55 
    4056   template <typename T> 
    4157   MAPNIK_DECL void save_to_file(std::string const& filename, 
  • trunk/src/image_util.cpp

    r571 r575  
    5656         else if (type == "png256") save_as_png256(file,image); 
    5757         else if (type=="jpeg") save_as_jpeg(file,85,image); 
     58         else throw ImageWriterException("unknown file type: " + type); 
    5859      }  
    5960   }