Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68150 - sandbox/gil/boost/gil/extension/io2
From: dsaritz_at_[hidden]
Date: 2011-01-14 08:17:58


Author: psiha
Date: 2011-01-14 08:17:57 EST (Fri, 14 Jan 2011)
New Revision: 68150
URL: http://svn.boost.org/trac/boost/changeset/68150

Log:
Added std::basic_string<> support to the read() and write() utility member functions.
Minor other refactoring.
Text files modified:
   sandbox/gil/boost/gil/extension/io2/formatted_image.hpp | 44 ++++++++++++++++++++++++++++++---------
   1 files changed, 34 insertions(+), 10 deletions(-)

Modified: sandbox/gil/boost/gil/extension/io2/formatted_image.hpp
==============================================================================
--- sandbox/gil/boost/gil/extension/io2/formatted_image.hpp (original)
+++ sandbox/gil/boost/gil/extension/io2/formatted_image.hpp 2011-01-14 08:17:57 EST (Fri, 14 Jan 2011)
@@ -906,24 +906,48 @@
         reader_t( target ).copy_to_image( image, synchronize_dimensions(), synchronize_formats() );
     }
 
+ template <typename char_type, class View>
+ static void read( std::basic_string<char_type> const & file_name, View const & view )
+ {
+ read( file_name.c_str(), view );
+ }
+
+ template <typename char_type, class View>
+ static void read( std::basic_string<char_type> & file_name, View const & view )
+ {
+ read( file_name.c_str(), view );
+ }
+
     template <class Target, class View>
     static void write( Target & target, View const & view )
     {
- // decay array to const pointer
- //...zzz...to add automatic support for char */char[] targets...clean this up...
- typedef typename decay<Target>::type decayed_target_t;
- typedef typename mpl::if_
- <
- is_pointer<decayed_target_t>,
- typename remove_pointer<decayed_target_t>::type const *,
- decayed_target_t
- >::type target_t;
- typedef typename writer_for<target_t>::type writer_t;
+ typedef typename writer_for<Target>::type writer_t;
         // The backend does not know how to write to the specified target type.
         BOOST_STATIC_ASSERT(( !is_same<writer_t, mpl::void_>::value ));
         writer_t( target, view ).write_default();
     }
 
+ template <class Target, class View>
+ static void write( Target * p_target, View const & view )
+ {
+ typedef typename writer_for<Target const *>::type writer_t;
+ // The backend does not know how to write to the specified target type.
+ BOOST_STATIC_ASSERT(( !is_same<writer_t, mpl::void_>::value ));
+ writer_t( p_target, view ).write_default();
+ }
+
+ template <typename char_type, class View>
+ static void write( std::basic_string<char_type> const & file_name, View const & view )
+ {
+ write( file_name.c_str(), view );
+ }
+
+ template <typename char_type, class View>
+ static void write( std::basic_string<char_type> & file_name, View const & view )
+ {
+ write( file_name.c_str(), view );
+ }
+
 private:
     template <class View, typename CC>
     class in_place_converter_t


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk