add VIPS_OPERATION_DEPRECATED

and fix a tiny problem in vipswrap7
This commit is contained in:
John Cupitt 2014-02-03 13:23:58 +00:00
parent 9f2169748b
commit b72818a2b8
8 changed files with 60 additions and 48 deletions

View File

@ -2,6 +2,7 @@
- auto-decode for (almost) all operations - auto-decode for (almost) all operations
- background render thread cleans up and quits neatly - background render thread cleans up and quits neatly
- colourspace has a source_space option - colourspace has a source_space option
- operations can be tagged as "deprecated"
22/1/14 started 7.38.2 22/1/14 started 7.38.2
- auto RAD decode for affine - auto RAD decode for affine

14
TODO
View File

@ -1,17 +1,3 @@
- can we deprecate classes? eg. VipsFormat and VipsWrap7 should be hidden
we have
gboolean output_needs_arg;
in vipsobjectclass at the moment, but that's the only flag-like thing
add a get_flags() member whose values include needs_arg and deprecated?
add a couple of void * blank pointers to object and objectclass for future
expansion .. a couple of ints as well?
- introspection example in gist should not list abstract classes?
- check_uncoded() left to do: - check_uncoded() left to do:

View File

@ -183,8 +183,7 @@ vips_wrap7_vargv_dispose( im_function *fn, im_object *vargv )
case VIPS_WRAP7_INTERPOLATE: case VIPS_WRAP7_INTERPOLATE:
case VIPS_WRAP7_IMAGE: case VIPS_WRAP7_IMAGE:
if( vargv[i] ) VIPS_UNREF( vargv[i] );
VIPS_UNREF( vargv[i] );
break; break;
case VIPS_WRAP7_IMAGEVEC: case VIPS_WRAP7_IMAGEVEC:
@ -193,13 +192,21 @@ vips_wrap7_vargv_dispose( im_function *fn, im_object *vargv )
int j; int j;
for( j = 0; j < iv->n; j++ ) for( j = 0; j < iv->n; j++ )
if( iv->vec[j] ) VIPS_UNREF( iv->vec[j] );
VIPS_UNREF( iv->vec[j] );
} }
break; break;
case VIPS_WRAP7_GVALUE: case VIPS_WRAP7_GVALUE:
g_value_unset( vargv[i] ); if( vargv[i] ) {
GValue *value = (GValue *) vargv[i];
if( G_VALUE_TYPE( value ) )
g_value_unset( value );
}
break;
case VIPS_WRAP7_STRING:
VIPS_FREE( vargv[i] );
break; break;
default: default:
@ -686,6 +693,7 @@ vips_wrap7_class_init( VipsWrap7Class *class )
{ {
GObjectClass *gobject_class = (GObjectClass *) class; GObjectClass *gobject_class = (GObjectClass *) class;
VipsObjectClass *vobject_class = (VipsObjectClass *) class; VipsObjectClass *vobject_class = (VipsObjectClass *) class;
VipsOperationClass *operation_class = (VipsOperationClass *) class;
gobject_class->dispose = vips_wrap7_dispose; gobject_class->dispose = vips_wrap7_dispose;
gobject_class->finalize = vips_wrap7_finalize; gobject_class->finalize = vips_wrap7_finalize;
@ -695,6 +703,8 @@ vips_wrap7_class_init( VipsWrap7Class *class )
vobject_class->build = vips_wrap7_build; vobject_class->build = vips_wrap7_build;
vobject_class->summary_class = vips_wrap7_summary_class; vobject_class->summary_class = vips_wrap7_summary_class;
vobject_class->dump = vips_wrap7_dump; vobject_class->dump = vips_wrap7_dump;
operation_class->flags = VIPS_OPERATION_DEPRECATED;
} }
static void static void

View File

@ -55,34 +55,6 @@ typedef struct _VipsObjectClass VipsObjectClass;
/* Track extra stuff for arguments to objects /* Track extra stuff for arguments to objects
*/ */
/**
* VipsArgumentFlags:
* @VIPS_ARGUMENT_NONE: no flags
* @VIPS_ARGUMENT_REQUIRED: must be set in the constructor
* @VIPS_ARGUMENT_CONSTRUCT: can only be set in the constructor
* @VIPS_ARGUMENT_SET_ONCE: can only be set once
* @VIPS_ARGUMENT_SET_ALWAYS: don't do use-before-set checks
* @VIPS_ARGUMENT_INPUT: is an input argument (one we depend on)
* @VIPS_ARGUMENT_OUTPUT: is an output argument (depends on us)
* @VIPS_ARGUMENT_DEPRECATED: just there for back-compat, hide
*
* Flags we associate with each object argument.
*
* Have separate input & output flags. Both set is an error; neither set is OK.
*
* Input gobjects are automatically reffed, output gobjects automatically ref
* us. We also automatically watch for "destroy" and unlink.
*
* @VIPS_ARGUMENT_SET_ALWAYS is handy for arguments which are set from C. For
* example, VipsImage::width is a property that gives access to the Xsize
* member of struct _VipsImage. We default its 'assigned' to TRUE
* since the field is always set directly by C.
*
* @VIPS_ARGUMENT_DEPRECATED arguments are not shown in help text, are not
* looked for if required, are not checked for "have-been-set". You can
* deprecate a required argument, but you must obviously add a new required
* argument if you do.
*/
typedef enum /*< flags >*/ { typedef enum /*< flags >*/ {
VIPS_ARGUMENT_NONE = 0, VIPS_ARGUMENT_NONE = 0,
VIPS_ARGUMENT_REQUIRED = 1, VIPS_ARGUMENT_REQUIRED = 1,
@ -461,6 +433,7 @@ struct _VipsObject {
* profiling. * profiling.
*/ */
size_t local_memory; size_t local_memory;
}; };
struct _VipsObjectClass { struct _VipsObjectClass {
@ -561,6 +534,13 @@ struct _VipsObjectClass {
*/ */
GSList *argument_table_traverse; GSList *argument_table_traverse;
GType argument_table_traverse_gtype; GType argument_table_traverse_gtype;
/* Reserved for future expansion.
*/
void (*_vips_reserved1)( void );
void (*_vips_reserved2)( void );
void (*_vips_reserved3)( void );
void (*_vips_reserved4)( void );
}; };
gboolean vips_value_is_null( GParamSpec *psoec, const GValue *value ); gboolean vips_value_is_null( GParamSpec *psoec, const GValue *value );

View File

@ -41,7 +41,8 @@ typedef enum /*< flags >*/ {
VIPS_OPERATION_NONE = 0, VIPS_OPERATION_NONE = 0,
VIPS_OPERATION_SEQUENTIAL = 1, VIPS_OPERATION_SEQUENTIAL = 1,
VIPS_OPERATION_SEQUENTIAL_UNBUFFERED = 2, VIPS_OPERATION_SEQUENTIAL_UNBUFFERED = 2,
VIPS_OPERATION_NOCACHE = 4 VIPS_OPERATION_NOCACHE = 4,
VIPS_OPERATION_DEPRECATED = 8
} VipsOperationFlags; } VipsOperationFlags;
#define VIPS_TYPE_OPERATION (vips_operation_get_type()) #define VIPS_TYPE_OPERATION (vips_operation_get_type())

View File

@ -624,6 +624,7 @@ vips_operation_flags_get_type( void )
{VIPS_OPERATION_SEQUENTIAL, "VIPS_OPERATION_SEQUENTIAL", "sequential"}, {VIPS_OPERATION_SEQUENTIAL, "VIPS_OPERATION_SEQUENTIAL", "sequential"},
{VIPS_OPERATION_SEQUENTIAL_UNBUFFERED, "VIPS_OPERATION_SEQUENTIAL_UNBUFFERED", "sequential-unbuffered"}, {VIPS_OPERATION_SEQUENTIAL_UNBUFFERED, "VIPS_OPERATION_SEQUENTIAL_UNBUFFERED", "sequential-unbuffered"},
{VIPS_OPERATION_NOCACHE, "VIPS_OPERATION_NOCACHE", "nocache"}, {VIPS_OPERATION_NOCACHE, "VIPS_OPERATION_NOCACHE", "nocache"},
{VIPS_OPERATION_DEPRECATED, "VIPS_OPERATION_DEPRECATED", "deprecated"},
{0, NULL, NULL} {0, NULL, NULL}
}; };

View File

@ -79,6 +79,35 @@
* *
*/ */
/**
* VipsArgumentFlags:
* @VIPS_ARGUMENT_NONE: no flags
* @VIPS_ARGUMENT_REQUIRED: must be set in the constructor
* @VIPS_ARGUMENT_CONSTRUCT: can only be set in the constructor
* @VIPS_ARGUMENT_SET_ONCE: can only be set once
* @VIPS_ARGUMENT_SET_ALWAYS: don't do use-before-set checks
* @VIPS_ARGUMENT_INPUT: is an input argument (one we depend on)
* @VIPS_ARGUMENT_OUTPUT: is an output argument (depends on us)
* @VIPS_ARGUMENT_DEPRECATED: just there for back-compat, hide
*
* Flags we associate with each object argument.
*
* Have separate input & output flags. Both set is an error; neither set is OK.
*
* Input gobjects are automatically reffed, output gobjects automatically ref
* us. We also automatically watch for "destroy" and unlink.
*
* @VIPS_ARGUMENT_SET_ALWAYS is handy for arguments which are set from C. For
* example, VipsImage::width is a property that gives access to the Xsize
* member of struct _VipsImage. We default its 'assigned' to TRUE
* since the field is always set directly by C.
*
* @VIPS_ARGUMENT_DEPRECATED arguments are not shown in help text, are not
* looked for if required, are not checked for "have-been-set". You can
* deprecate a required argument, but you must obviously add a new required
* argument if you do.
*/
/* Our signals. /* Our signals.
*/ */
enum { enum {

View File

@ -70,6 +70,7 @@
* @VIPS_OPERATION_NONE: no flags * @VIPS_OPERATION_NONE: no flags
* @VIPS_OPERATION_SEQUENTIAL: can work sequentially * @VIPS_OPERATION_SEQUENTIAL: can work sequentially
* @VIPS_OPERATION_NOCACHE: must not be cached * @VIPS_OPERATION_NOCACHE: must not be cached
* @VIPS_OPERATION_DEPRECATED: a compatibility thing
* *
* Flags we associate with an operation. * Flags we associate with an operation.
* *
@ -83,6 +84,9 @@
* *
* @VIPS_OPERATION_NOCACHE means that the operation must not be cached by * @VIPS_OPERATION_NOCACHE means that the operation must not be cached by
* vips. * vips.
*
* @VIPS_OPERATION_DEPRECATED means this is an old operation kept in vips for
* compatibility only and should be hidden from users.
*/ */
/* Abstract base class for operations. /* Abstract base class for operations.