Skip to content

Commit c397543

Browse files
committedJan 11, 2019
Add a std::string overload function for new_from_buffer
1 parent bd5711e commit c397543

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed
 

‎cplusplus/VError.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#endif /*HAVE_CONFIG_H*/
3333
#include <vips/intl.h>
3434

35-
#include <iostream>
36-
3735
#include <vips/vips8>
3836

3937
VIPS_NAMESPACE_START

‎cplusplus/VImage.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ VImage::new_from_file( const char *name, VOption *options )
563563
}
564564

565565
VImage
566-
VImage::new_from_buffer( void *buf, size_t len, const char *option_string,
566+
VImage::new_from_buffer( const void *buf, size_t len, const char *option_string,
567567
VOption *options )
568568
{
569569
const char *operation_name;
@@ -588,6 +588,13 @@ VImage::new_from_buffer( void *buf, size_t len, const char *option_string,
588588
return( out );
589589
}
590590

591+
VImage
592+
VImage::new_from_buffer( const std::string &buf, const char *option_string,
593+
VOption *options )
594+
{
595+
return( new_from_buffer( buf.c_str(), buf.size(), option_string, options ) );
596+
}
597+
591598
VImage
592599
VImage::new_matrix( int width, int height )
593600
{

‎cplusplus/include/vips/VError8.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#ifndef VIPS_VERROR_H
3232
#define VIPS_VERROR_H
3333

34-
#include <string>
35-
#include <iosfwd>
34+
#include <cstring>
35+
#include <ostream>
3636
#include <exception>
3737

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

4545
public:
46-
VError( std::string what ) : _what( what ) {}
46+
VError( const std::string &what ) : _what( what ) {}
4747
VError() : _what( vips_error_buffer() ) {}
4848
virtual ~VError() throw() {}
4949

‎cplusplus/include/vips/VImage8.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <complex>
3535
#include <vector>
3636

37-
#include <string.h>
37+
#include <cstring>
3838

3939
#include <vips/vips.h>
4040

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

473-
static VImage new_from_buffer( void *buf, size_t len,
473+
static VImage new_from_buffer( const void *buf, size_t len,
474+
const char *option_string, VOption *options = 0 );
475+
476+
static VImage new_from_buffer( const std::string &buf,
474477
const char *option_string, VOption *options = 0 );
475478

476479
static VImage new_matrix( int width, int height );

‎cplusplus/include/vips/VInterpolate8.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <complex>
3535
#include <vector>
3636

37-
#include <string.h>
37+
#include <cstring>
3838

3939
#include <vips/vips.h>
4040

0 commit comments

Comments
 (0)
Please sign in to comment.