Permalink
Browse files

Add a std::string overload function for new_from_buffer

  • Loading branch information...
kleisauke committed Jan 11, 2019
1 parent bd5711e commit c397543c8e1710d57d61e788a72dfd84e8aeabf0
@@ -32,8 +32,6 @@
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>

#include <iostream>

#include <vips/vips8>

VIPS_NAMESPACE_START
@@ -563,7 +563,7 @@ VImage::new_from_file( const char *name, VOption *options )
}

VImage
VImage::new_from_buffer( void *buf, size_t len, const char *option_string,
VImage::new_from_buffer( const void *buf, size_t len, const char *option_string,
VOption *options )
{
const char *operation_name;
@@ -588,6 +588,13 @@ VImage::new_from_buffer( void *buf, size_t len, const char *option_string,
return( out );
}

VImage
VImage::new_from_buffer( const std::string &buf, const char *option_string,
VOption *options )
{
return( new_from_buffer( buf.c_str(), buf.size(), option_string, options ) );
}

VImage
VImage::new_matrix( int width, int height )
{
@@ -31,8 +31,8 @@
#ifndef VIPS_VERROR_H
#define VIPS_VERROR_H

#include <string>
#include <iosfwd>
#include <cstring>
#include <ostream>
#include <exception>

#include <vips/vips.h>
@@ -43,7 +43,7 @@ class VIPS_CPLUSPLUS_API VError : public std::exception {
std::string _what;

public:
VError( std::string what ) : _what( what ) {}
VError( const std::string &what ) : _what( what ) {}
VError() : _what( vips_error_buffer() ) {}
virtual ~VError() throw() {}

@@ -34,7 +34,7 @@
#include <complex>
#include <vector>

#include <string.h>
#include <cstring>

#include <vips/vips.h>

@@ -470,7 +470,10 @@ class VImage : VObject
return( VImage( image ) );
}

static VImage new_from_buffer( void *buf, size_t len,
static VImage new_from_buffer( const void *buf, size_t len,
const char *option_string, VOption *options = 0 );

static VImage new_from_buffer( const std::string &buf,
const char *option_string, VOption *options = 0 );

static VImage new_matrix( int width, int height );
@@ -34,7 +34,7 @@
#include <complex>
#include <vector>

#include <string.h>
#include <cstring>

#include <vips/vips.h>

0 comments on commit c397543

Please sign in to comment.