diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-01-08 21:20:41 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-01-08 21:20:41 +0100 |
commit | ad75f70efce21330f8d5971d065df97e0c1383ca (patch) | |
tree | 98a100ff0a76a9ce724c57fe05d9fdce8e5d0fc2 /src/exiv2wrapper.cpp | |
parent | 9e00ddff83b1657ffafe5d390f49f096a5c4e2aa (diff) | |
download | pyexiv2-ad75f70efce21330f8d5971d065df97e0c1383ca.tar.gz |
Preview::writeToFile dumps the preview data to a file.
Diffstat (limited to 'src/exiv2wrapper.cpp')
-rw-r--r-- | src/exiv2wrapper.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index 3dbd8b2..26747ae 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -27,6 +27,8 @@ #include "boost/python/stl_iterator.hpp" +#include <fstream> + // Custom error codes for Exiv2 exceptions #define METADATA_NOT_READ 101 #define NON_REPEATABLE 102 @@ -814,6 +816,14 @@ Preview::Preview(const Exiv2::PreviewImage& previewImage) } } +void Preview::writeToFile(const std::string& path) const +{ + std::string filename = path + _extension; + std::ofstream fd(filename.c_str(), std::ios::out); + fd << _data; + fd.close(); +} + // TODO: update the errors code to reflect changes from src/error.cpp in libexiv2 void translateExiv2Error(Exiv2::Error const& error) |