full cpp wrapper compiles

This commit is contained in:
John Cupitt 2014-10-28 10:12:06 +00:00
parent 63d4370043
commit cabb4488be
6 changed files with 128 additions and 47 deletions

View File

@ -51,13 +51,14 @@ VOption::~VOption()
delete *i;
}
VOption *VOption::set( const char *name, const char *value )
// input bool
VOption *VOption::set( const char *name, bool value )
{
Pair *pair = new Pair( name );
pair->input = true;
g_value_init( &pair->value, G_TYPE_STRING );
g_value_set_string( &pair->value, value );
g_value_init( &pair->value, G_TYPE_BOOLEAN );
g_value_set_boolean( &pair->value, value );
options.push_back( pair );
return( this );
@ -76,6 +77,31 @@ VOption *VOption::set( const char *name, int value )
return( this );
}
// input double
VOption *VOption::set( const char *name, double value )
{
Pair *pair = new Pair( name );
pair->input = true;
g_value_init( &pair->value, G_TYPE_DOUBLE );
g_value_set_double( &pair->value, value );
options.push_back( pair );
return( this );
}
VOption *VOption::set( const char *name, const char *value )
{
Pair *pair = new Pair( name );
pair->input = true;
g_value_init( &pair->value, G_TYPE_STRING );
g_value_set_string( &pair->value, value );
options.push_back( pair );
return( this );
}
// input image
VOption *VOption::set( const char *name, VImage value )
{
@ -136,30 +162,28 @@ VOption *VOption::set( const char *name, std::vector<VImage> value )
return( this );
}
// output image
VOption *VOption::set( const char *name, VImage *value )
// input blob
VOption *VOption::set( const char *name, VipsBlob *value )
{
Pair *pair = new Pair( name );
// note where we will write the VImage on success
pair->input = false;
pair->vimage = value;
g_value_init( &pair->value, VIPS_TYPE_IMAGE );
pair->input = true;
g_value_init( &pair->value, VIPS_TYPE_BLOB );
g_value_set_boxed( &pair->value, value );
options.push_back( pair );
return( this );
}
// output double
VOption *VOption::set( const char *name, double *value )
// output bool
VOption *VOption::set( const char *name, bool *value )
{
Pair *pair = new Pair( name );
// note where we will write the VImage on success
pair->input = false;
pair->vdouble = value;
g_value_init( &pair->value, G_TYPE_DOUBLE );
pair->vbool = value;
g_value_init( &pair->value, G_TYPE_BOOLEAN );
options.push_back( pair );
@ -181,14 +205,57 @@ VOption *VOption::set( const char *name, int *value )
return( this );
}
// output doublearray
VOption *VOption::set( const char *name, std::vector<double> **value )
// output double
VOption *VOption::set( const char *name, double *value )
{
Pair *pair = new Pair( name );
// note where we will write the VImage on success
pair->input = false;
pair->vdoublearray = value;
pair->vdouble = value;
g_value_init( &pair->value, G_TYPE_DOUBLE );
options.push_back( pair );
return( this );
}
// output image
VOption *VOption::set( const char *name, VImage *value )
{
Pair *pair = new Pair( name );
// note where we will write the VImage on success
pair->input = false;
pair->vimage = value;
g_value_init( &pair->value, VIPS_TYPE_IMAGE );
options.push_back( pair );
return( this );
}
// output doublearray
VOption *VOption::set( const char *name, std::vector<double> *value )
{
Pair *pair = new Pair( name );
// note where we will write the VImage on success
pair->input = false;
pair->vvector = value;
options.push_back( pair );
return( this );
}
// output blob
VOption *VOption::set( const char *name, VipsBlob **value )
{
Pair *pair = new Pair( name );
pair->input = false;
pair->vblob = value;
options.push_back( pair );
@ -246,6 +313,8 @@ void VOption::get_operation( VipsOperation *operation )
}
else if( type == G_TYPE_INT )
*((*i)->vint) = g_value_get_int( value );
else if( type == G_TYPE_BOOLEAN )
*((*i)->vbool) = g_value_get_boolean( value );
else if( type == G_TYPE_DOUBLE )
*((*i)->vint) = g_value_get_double( value );
else if( type == VIPS_TYPE_ARRAY_DOUBLE ) {
@ -253,14 +322,15 @@ void VOption::get_operation( VipsOperation *operation )
double *array =
vips_value_get_array_double( value,
&length );
std::vector<double> *vector =
new std::vector<double>( length );
int j;
((*i)->vvector)->resize( length );
for( j = 0; j < length; j++ )
(*vector)[j] = array[j];
*((*i)->vdoublearray) = vector;
(*((*i)->vvector))[j] = array[j];
}
else if( type == VIPS_TYPE_BLOB ) {
*((*i)->vblob) =
(VipsBlob *) g_value_get_boxed( value );
}
}
}

View File

@ -38,7 +38,7 @@ gtype_to_cpp = {
"gchararray" : "char *",
"VipsArrayDouble" : "std::vector<double>",
"VipsArrayImage" : "std::vector<VImage>",
"VipsBlob" : "void *"
"VipsBlob" : "VipsBlob *"
}
def get_ctype(prop):

View File

@ -179,7 +179,13 @@ private:
int *vint;
// output doublearray
std::vector<double> **vdoublearray;
std::vector<double> *vvector;
// output Blob
VipsBlob **vblob;
// output bool
bool *vbool;
};
Pair( const char *name ) :
@ -203,16 +209,21 @@ public:
virtual ~VOption();
VOption *set( const char *name, const char *value );
VOption *set( const char *name, bool value );
VOption *set( const char *name, int value );
VOption *set( const char *name, double value );
VOption *set( const char *name, const char *value );
VOption *set( const char *name, VImage value );
VOption *set( const char *name, VImage *value );
VOption *set( const char *name, std::vector<VImage> value );
VOption *set( const char *name, std::vector<double> value );
VOption *set( const char *name, VipsBlob *value );
VOption *set( const char *name, bool *value );
VOption *set( const char *name, int *value );
VOption *set( const char *name, double *value );
VOption *set( const char *name, std::vector<double> **value );
VOption *set( const char *name, VImage *value );
VOption *set( const char *name, std::vector<double> *value );
VOption *set( const char *name, VipsBlob **blob );
void set_operation( VipsOperation *operation );
void get_operation( VipsOperation *operation );

View File

@ -28,7 +28,7 @@ gtype_to_cpp = {
"gchararray" : "char *",
"VipsArrayDouble" : "std::vector<double>",
"VipsArrayImage" : "std::vector<VImage>",
"VipsBlob" : "void *"
"VipsBlob" : "VipsBlob *"
}
def get_ctype(prop):

View File

@ -1,5 +1,5 @@
// headers for vips operations
// Mon Oct 27 17:00:38 GMT 2014
// Tue Oct 28 10:00:17 GMT 2014
// this file is generated automatically, do not edit!
static void system( char * cmd_format , VOption *options = 0 )
@ -208,21 +208,21 @@ static VImage vipsload( char * filename , VOption *options = 0 )
throw( VError );
static VImage pngload( char * filename , VOption *options = 0 )
throw( VError );
static VImage pngload_buffer( void * buffer , VOption *options = 0 )
static VImage pngload_buffer( VipsBlob * buffer , VOption *options = 0 )
throw( VError );
static VImage matload( char * filename , VOption *options = 0 )
throw( VError );
static VImage jpegload( char * filename , VOption *options = 0 )
throw( VError );
static VImage jpegload_buffer( void * buffer , VOption *options = 0 )
static VImage jpegload_buffer( VipsBlob * buffer , VOption *options = 0 )
throw( VError );
static VImage webpload( char * filename , VOption *options = 0 )
throw( VError );
static VImage webpload_buffer( void * buffer , VOption *options = 0 )
static VImage webpload_buffer( VipsBlob * buffer , VOption *options = 0 )
throw( VError );
static VImage tiffload( char * filename , VOption *options = 0 )
throw( VError );
static VImage tiffload_buffer( void * buffer , VOption *options = 0 )
static VImage tiffload_buffer( VipsBlob * buffer , VOption *options = 0 )
throw( VError );
static VImage openslideload( char * filename , VOption *options = 0 )
throw( VError );
@ -252,17 +252,17 @@ void dzsave( char * filename , VOption *options = 0 )
throw( VError );
void pngsave( char * filename , VOption *options = 0 )
throw( VError );
void * pngsave_buffer( VOption *options = 0 )
VipsBlob * pngsave_buffer( VOption *options = 0 )
throw( VError );
void jpegsave( char * filename , VOption *options = 0 )
throw( VError );
void * jpegsave_buffer( VOption *options = 0 )
VipsBlob * jpegsave_buffer( VOption *options = 0 )
throw( VError );
void jpegsave_mime( VOption *options = 0 )
throw( VError );
void webpsave( char * filename , VOption *options = 0 )
throw( VError );
void * webpsave_buffer( VOption *options = 0 )
VipsBlob * webpsave_buffer( VOption *options = 0 )
throw( VError );
void tiffsave( char * filename , VOption *options = 0 )
throw( VError );

View File

@ -1,5 +1,5 @@
// bodies for vips operations
// Mon Oct 27 17:08:34 GMT 2014
// Tue Oct 28 10:00:00 GMT 2014
// this file is generated automatically, do not edit!
void VImage::system( char * cmd_format , VOption *options )
@ -1450,7 +1450,7 @@ VImage VImage::pngload( char * filename , VOption *options )
return( out );
}
VImage VImage::pngload_buffer( void * buffer , VOption *options )
VImage VImage::pngload_buffer( VipsBlob * buffer , VOption *options )
throw( VError )
{
VImage out;
@ -1489,7 +1489,7 @@ VImage VImage::jpegload( char * filename , VOption *options )
return( out );
}
VImage VImage::jpegload_buffer( void * buffer , VOption *options )
VImage VImage::jpegload_buffer( VipsBlob * buffer , VOption *options )
throw( VError )
{
VImage out;
@ -1515,7 +1515,7 @@ VImage VImage::webpload( char * filename , VOption *options )
return( out );
}
VImage VImage::webpload_buffer( void * buffer , VOption *options )
VImage VImage::webpload_buffer( VipsBlob * buffer , VOption *options )
throw( VError )
{
VImage out;
@ -1541,7 +1541,7 @@ VImage VImage::tiffload( char * filename , VOption *options )
return( out );
}
VImage VImage::tiffload_buffer( void * buffer , VOption *options )
VImage VImage::tiffload_buffer( VipsBlob * buffer , VOption *options )
throw( VError )
{
VImage out;
@ -1695,10 +1695,10 @@ void VImage::pngsave( char * filename , VOption *options )
set( "filename", filename ) );
}
void * VImage::pngsave_buffer( VOption *options )
VipsBlob * VImage::pngsave_buffer( VOption *options )
throw( VError )
{
void * buffer;
VipsBlob * buffer;
call( "pngsave_buffer" ,
(options ? options : VImage::option()) ->
@ -1717,10 +1717,10 @@ void VImage::jpegsave( char * filename , VOption *options )
set( "filename", filename ) );
}
void * VImage::jpegsave_buffer( VOption *options )
VipsBlob * VImage::jpegsave_buffer( VOption *options )
throw( VError )
{
void * buffer;
VipsBlob * buffer;
call( "jpegsave_buffer" ,
(options ? options : VImage::option()) ->
@ -1747,10 +1747,10 @@ void VImage::webpsave( char * filename , VOption *options )
set( "filename", filename ) );
}
void * VImage::webpsave_buffer( VOption *options )
VipsBlob * VImage::webpsave_buffer( VOption *options )
throw( VError )
{
void * buffer;
VipsBlob * buffer;
call( "webpsave_buffer" ,
(options ? options : VImage::option()) ->