sync
This commit is contained in:
parent
a5b8a21a54
commit
045c2b37aa
15
TODO
15
TODO
|
@ -12,10 +12,25 @@
|
|||
to spot vector args, since we don't have the idea of generic vector in the
|
||||
type system
|
||||
|
||||
we can't make a generic VIPS_TYPE_ARRAY boxed, since
|
||||
g_boxed_type_register_static() does not let us specify a parent class, the
|
||||
code has G_TYPE_BOXED hardwired as the parent class
|
||||
|
||||
instead, perhaps derive from G_TYPE_PARAM_BOXED to create
|
||||
VIPS_TYPE_PARAM_ARRAY, a boxed param that can only be a VipsArea array ...
|
||||
would this work?
|
||||
|
||||
nope, g_param_type_register_static() is also hardwired to have G_TYPE_PARAM
|
||||
as its parent class argh
|
||||
|
||||
best we can do is register a char->value transform in each array type, and
|
||||
have the generic transformer as a utility function
|
||||
|
||||
|
||||
|
||||
break in transform_g_string_array() and try running with --background
|
||||
|
||||
do we have anything in dest_value we can use to decide what type to write?
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1575,13 +1575,39 @@ transform_array_g_string( const GValue *src_value, GValue *dest_value )
|
|||
g_value_set_string( dest_value, vips_buf_all( &buf ) );
|
||||
}
|
||||
|
||||
/* We don't have functions to save arrays to save_str and back. We'd need to
|
||||
* save the type as well as the members and number of members, something like:
|
||||
*
|
||||
* double { 12.3, 13.7 }
|
||||
*
|
||||
* Anyway, no call for this yet.
|
||||
*/
|
||||
static void
|
||||
transform_g_string_array( const GValue *src_value, GValue *dest_value )
|
||||
{
|
||||
const char *str = g_value_get_string( src_value );
|
||||
|
||||
int n;
|
||||
const char *p;
|
||||
int i;
|
||||
GType type;
|
||||
|
||||
/* Walk the string to get the number of elements. Empty string is zero
|
||||
* elements.
|
||||
*/
|
||||
for( n = 0, p = str; p && *p; n += 1 ) {
|
||||
p = strchr( p, ',' );
|
||||
if( p )
|
||||
p += 1;
|
||||
}
|
||||
|
||||
for( i = 0; i < n; i++ ) {
|
||||
GValue value = { 0, };
|
||||
char *str;
|
||||
|
||||
g_value_init( &value, type );
|
||||
//g_value_set_instance( &value, array );
|
||||
|
||||
g_value_unset( &value );
|
||||
|
||||
// array += sizeof_type;
|
||||
}
|
||||
|
||||
// g_value_set_string( dest_value, vips_buf_all( &buf ) );
|
||||
}
|
||||
|
||||
GType
|
||||
vips_array_double_get_type( void )
|
||||
|
@ -1594,6 +1620,8 @@ vips_array_double_get_type( void )
|
|||
(GBoxedFreeFunc) vips_area_unref );
|
||||
g_value_register_transform_func( type, G_TYPE_STRING,
|
||||
transform_array_g_string );
|
||||
g_value_register_transform_func( G_TYPE_STRING, type,
|
||||
transform_g_string_array );
|
||||
}
|
||||
|
||||
return( type );
|
||||
|
|
Loading…
Reference in New Issue