1 /* LIBGIMP - The GIMP Library
2 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
4 * gimpproceduraldb_pdb.c
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <https://www.gnu.org/licenses/>.
21 /* NOTE: This file is auto-generated by pdbgen.pl */
31 * SECTION: gimpproceduraldb
32 * @title: gimpproceduraldb
33 * @short_description: Functions for querying and changing procedural database (PDB) entries.
35 * Functions for querying and changing procedural database (PDB)
41 * gimp_procedural_db_temp_name:
43 * Generates a unique temporary PDB name.
45 * This procedure generates a temporary PDB entry name that is
46 * guaranteed to be unique.
48 * Returns: A unique temporary name for a temporary PDB entry.
51 gimp_procedural_db_temp_name (void)
53 GimpParam
*return_vals
;
55 gchar
*temp_name
= NULL
;
57 return_vals
= gimp_run_procedure ("gimp-procedural-db-temp-name",
61 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
62 temp_name
= g_strdup (return_vals
[1].data
.d_string
);
64 gimp_destroy_params (return_vals
, nreturn_vals
);
70 * gimp_procedural_db_dump:
71 * @filename: The dump filename.
73 * Dumps the current contents of the procedural database
75 * This procedure dumps the contents of the procedural database to the
76 * specified file. The file will contain all of the information
77 * provided for each registered procedure.
79 * Returns: TRUE on success.
82 gimp_procedural_db_dump (const gchar
*filename
)
84 GimpParam
*return_vals
;
86 gboolean success
= TRUE
;
88 return_vals
= gimp_run_procedure ("gimp-procedural-db-dump",
90 GIMP_PDB_STRING
, filename
,
93 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
95 gimp_destroy_params (return_vals
, nreturn_vals
);
101 * gimp_procedural_db_query:
102 * @name: The regex for procedure name.
103 * @blurb: The regex for procedure blurb.
104 * @help: The regex for procedure help.
105 * @author: The regex for procedure author.
106 * @copyright: The regex for procedure copyright.
107 * @date: The regex for procedure date.
108 * @proc_type: The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension', 'Temporary Procedure' }.
109 * @num_matches: The number of matching procedures.
110 * @procedure_names: The list of procedure names.
112 * Queries the procedural database for its contents using regular
113 * expression matching.
115 * This procedure queries the contents of the procedural database. It
116 * is supplied with seven arguments matching procedures on { name,
117 * blurb, help, author, copyright, date, procedure type}. This is
118 * accomplished using regular expression matching. For instance, to
119 * find all procedures with \"jpeg\" listed in the blurb, all seven
120 * arguments can be supplied as \".*\", except for the second, which
121 * can be supplied as \".*jpeg.*\". There are two return arguments for
122 * this procedure. The first is the number of procedures matching the
123 * query. The second is a concatenated list of procedure names
124 * corresponding to those matching the query. If no matching entries
125 * are found, then the returned string is NULL and the number of
128 * Returns: TRUE on success.
131 gimp_procedural_db_query (const gchar
*name
,
135 const gchar
*copyright
,
137 const gchar
*proc_type
,
139 gchar
***procedure_names
)
141 GimpParam
*return_vals
;
143 gboolean success
= TRUE
;
146 return_vals
= gimp_run_procedure ("gimp-procedural-db-query",
148 GIMP_PDB_STRING
, name
,
149 GIMP_PDB_STRING
, blurb
,
150 GIMP_PDB_STRING
, help
,
151 GIMP_PDB_STRING
, author
,
152 GIMP_PDB_STRING
, copyright
,
153 GIMP_PDB_STRING
, date
,
154 GIMP_PDB_STRING
, proc_type
,
158 *procedure_names
= NULL
;
160 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
164 *num_matches
= return_vals
[1].data
.d_int32
;
165 if (*num_matches
> 0)
167 *procedure_names
= g_new0 (gchar
*, *num_matches
+ 1);
168 for (i
= 0; i
< *num_matches
; i
++)
169 (*procedure_names
)[i
] = g_strdup (return_vals
[2].data
.d_stringarray
[i
]);
173 gimp_destroy_params (return_vals
, nreturn_vals
);
179 * gimp_procedural_db_proc_exists:
180 * @procedure_name: The procedure name.
182 * Checks if the specified procedure exists in the procedural database
184 * This procedure checks if the specified procedure is registered in
185 * the procedural database.
187 * Returns: Whether a procedure of that name is registered.
192 gimp_procedural_db_proc_exists (const gchar
*procedure_name
)
194 GimpParam
*return_vals
;
196 gboolean exists
= FALSE
;
198 return_vals
= gimp_run_procedure ("gimp-procedural-db-proc-exists",
200 GIMP_PDB_STRING
, procedure_name
,
203 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
204 exists
= return_vals
[1].data
.d_int32
;
206 gimp_destroy_params (return_vals
, nreturn_vals
);
212 * _gimp_procedural_db_proc_info:
213 * @procedure_name: The procedure name.
214 * @blurb: A short blurb.
215 * @help: Detailed procedure help.
216 * @author: Author(s) of the procedure.
217 * @copyright: The copyright.
218 * @date: Copyright date.
219 * @proc_type: The procedure type.
220 * @num_args: The number of input arguments.
221 * @num_values: The number of return values.
223 * Queries the procedural database for information on the specified
226 * This procedure returns information on the specified procedure. A
227 * short blurb, detailed help, author(s), copyright information,
228 * procedure type, number of input, and number of return values are
229 * returned. For specific information on each input argument and return
230 * value, use the gimp_procedural_db_proc_arg() and
231 * gimp_procedural_db_proc_val() procedures.
233 * Returns: TRUE on success.
236 _gimp_procedural_db_proc_info (const gchar
*procedure_name
,
242 GimpPDBProcType
*proc_type
,
246 GimpParam
*return_vals
;
248 gboolean success
= TRUE
;
250 return_vals
= gimp_run_procedure ("gimp-procedural-db-proc-info",
252 GIMP_PDB_STRING
, procedure_name
,
264 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
268 *blurb
= g_strdup (return_vals
[1].data
.d_string
);
269 *help
= g_strdup (return_vals
[2].data
.d_string
);
270 *author
= g_strdup (return_vals
[3].data
.d_string
);
271 *copyright
= g_strdup (return_vals
[4].data
.d_string
);
272 *date
= g_strdup (return_vals
[5].data
.d_string
);
273 *proc_type
= return_vals
[6].data
.d_int32
;
274 *num_args
= return_vals
[7].data
.d_int32
;
275 *num_values
= return_vals
[8].data
.d_int32
;
278 gimp_destroy_params (return_vals
, nreturn_vals
);
284 * gimp_procedural_db_proc_arg:
285 * @procedure_name: The procedure name.
286 * @arg_num: The argument number.
287 * @arg_type: The type of argument.
288 * @arg_name: The name of the argument.
289 * @arg_desc: A description of the argument.
291 * Queries the procedural database for information on the specified
292 * procedure's argument.
294 * This procedure returns information on the specified procedure's
295 * argument. The argument type, name, and a description are retrieved.
297 * Returns: TRUE on success.
300 gimp_procedural_db_proc_arg (const gchar
*procedure_name
,
302 GimpPDBArgType
*arg_type
,
306 GimpParam
*return_vals
;
308 gboolean success
= TRUE
;
310 return_vals
= gimp_run_procedure ("gimp-procedural-db-proc-arg",
312 GIMP_PDB_STRING
, procedure_name
,
313 GIMP_PDB_INT32
, arg_num
,
320 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
324 *arg_type
= return_vals
[1].data
.d_int32
;
325 *arg_name
= g_strdup (return_vals
[2].data
.d_string
);
326 *arg_desc
= g_strdup (return_vals
[3].data
.d_string
);
329 gimp_destroy_params (return_vals
, nreturn_vals
);
335 * gimp_procedural_db_proc_val:
336 * @procedure_name: The procedure name.
337 * @val_num: The return value number.
338 * @val_type: The type of return value.
339 * @val_name: The name of the return value.
340 * @val_desc: A description of the return value.
342 * Queries the procedural database for information on the specified
343 * procedure's return value.
345 * This procedure returns information on the specified procedure's
346 * return value. The return value type, name, and a description are
349 * Returns: TRUE on success.
352 gimp_procedural_db_proc_val (const gchar
*procedure_name
,
354 GimpPDBArgType
*val_type
,
358 GimpParam
*return_vals
;
360 gboolean success
= TRUE
;
362 return_vals
= gimp_run_procedure ("gimp-procedural-db-proc-val",
364 GIMP_PDB_STRING
, procedure_name
,
365 GIMP_PDB_INT32
, val_num
,
372 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
376 *val_type
= return_vals
[1].data
.d_int32
;
377 *val_name
= g_strdup (return_vals
[2].data
.d_string
);
378 *val_desc
= g_strdup (return_vals
[3].data
.d_string
);
381 gimp_destroy_params (return_vals
, nreturn_vals
);
387 * _gimp_procedural_db_get_data:
388 * @identifier: The identifier associated with data.
389 * @bytes: The number of bytes in the data.
390 * @data: A byte array containing data.
392 * Returns data associated with the specified identifier.
394 * This procedure returns any data which may have been associated with
395 * the specified identifier. The data is a variable length array of
396 * bytes. If no data has been associated with the identifier, an error
399 * Returns: TRUE on success.
402 _gimp_procedural_db_get_data (const gchar
*identifier
,
406 GimpParam
*return_vals
;
408 gboolean success
= TRUE
;
410 return_vals
= gimp_run_procedure ("gimp-procedural-db-get-data",
412 GIMP_PDB_STRING
, identifier
,
418 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
422 *bytes
= return_vals
[1].data
.d_int32
;
423 *data
= g_new (guint8
, *bytes
);
425 return_vals
[2].data
.d_int8array
,
426 *bytes
* sizeof (guint8
));
429 gimp_destroy_params (return_vals
, nreturn_vals
);
435 * gimp_procedural_db_get_data_size:
436 * @identifier: The identifier associated with data.
438 * Returns size of data associated with the specified identifier.
440 * This procedure returns the size of any data which may have been
441 * associated with the specified identifier. If no data has been
442 * associated with the identifier, an error is returned.
444 * Returns: The number of bytes in the data.
447 gimp_procedural_db_get_data_size (const gchar
*identifier
)
449 GimpParam
*return_vals
;
453 return_vals
= gimp_run_procedure ("gimp-procedural-db-get-data-size",
455 GIMP_PDB_STRING
, identifier
,
458 if (return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
)
459 bytes
= return_vals
[1].data
.d_int32
;
461 gimp_destroy_params (return_vals
, nreturn_vals
);
467 * _gimp_procedural_db_set_data:
468 * @identifier: The identifier associated with data.
469 * @bytes: The number of bytes in the data.
470 * @data: A byte array containing data.
472 * Associates the specified identifier with the supplied data.
474 * This procedure associates the supplied data with the provided
475 * identifier. The data may be subsequently retrieved by a call to
476 * 'procedural-db-get-data'.
478 * Returns: TRUE on success.
481 _gimp_procedural_db_set_data (const gchar
*identifier
,
485 GimpParam
*return_vals
;
487 gboolean success
= TRUE
;
489 return_vals
= gimp_run_procedure ("gimp-procedural-db-set-data",
491 GIMP_PDB_STRING
, identifier
,
492 GIMP_PDB_INT32
, bytes
,
493 GIMP_PDB_INT8ARRAY
, data
,
496 success
= return_vals
[0].data
.d_status
== GIMP_PDB_SUCCESS
;
498 gimp_destroy_params (return_vals
, nreturn_vals
);