1 /* LIBGIMP - The GIMP Library
2  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
3  *
4  * gimpparasite.h
5  * Copyright (C) 1998 Jay Cox <jaycox@gimp.org>
6  *
7  * This library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 3 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library.  If not, see
19  * <https://www.gnu.org/licenses/>.
20  */
21 
22 #if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
23 #error "Only <libgimpbase/gimpbase.h> can be included directly."
24 #endif
25 
26 #ifndef __GIMP_PARASITE_H__
27 #define __GIMP_PARASITE_H__
28 
29 G_BEGIN_DECLS
30 
31 /* For information look into the C source or the html documentation */
32 
33 
34 /*
35  * GIMP_TYPE_PARASITE
36  */
37 
38 #define GIMP_TYPE_PARASITE               (gimp_parasite_get_type ())
39 #define GIMP_VALUE_HOLDS_PARASITE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_PARASITE))
40 
41 GType   gimp_parasite_get_type           (void) G_GNUC_CONST;
42 
43 
44 /*
45  * GIMP_TYPE_PARAM_PARASITE
46  */
47 
48 #define GIMP_TYPE_PARAM_PARASITE           (gimp_param_parasite_get_type ())
49 #define GIMP_IS_PARAM_SPEC_PARASITE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_PARASITE))
50 
51 GType        gimp_param_parasite_get_type  (void) G_GNUC_CONST;
52 
53 GParamSpec * gimp_param_spec_parasite      (const gchar  *name,
54                                             const gchar  *nick,
55                                             const gchar  *blurb,
56                                             GParamFlags   flags);
57 
58 
59 #define GIMP_PARASITE_PERSISTENT 1
60 #define GIMP_PARASITE_UNDOABLE   2
61 
62 #define GIMP_PARASITE_ATTACH_PARENT     (0x80 << 8)
63 #define GIMP_PARASITE_PARENT_PERSISTENT (GIMP_PARASITE_PERSISTENT << 8)
64 #define GIMP_PARASITE_PARENT_UNDOABLE   (GIMP_PARASITE_UNDOABLE << 8)
65 
66 #define GIMP_PARASITE_ATTACH_GRANDPARENT     (0x80 << 16)
67 #define GIMP_PARASITE_GRANDPARENT_PERSISTENT (GIMP_PARASITE_PERSISTENT << 16)
68 #define GIMP_PARASITE_GRANDPARENT_UNDOABLE   (GIMP_PARASITE_UNDOABLE << 16)
69 
70 
71 /**
72  * GimpParasite:
73  * @name:  the parasite name, USE A UNIQUE PREFIX
74  * @flags: the parasite flags, like save in XCF etc.
75  * @size:  the parasite size in bytes
76  * @data:  the parasite data, the owner os the parasite is responsible
77  *   for tracking byte order and internal structure
78  **/
79 struct _GimpParasite
80 {
81   gchar    *name;
82   guint32   flags;
83   guint32   size;
84   gpointer  data;
85 };
86 
87 
88 GimpParasite * gimp_parasite_new           (const gchar        *name,
89                                             guint32             flags,
90                                             guint32             size,
91                                             gconstpointer       data);
92 void           gimp_parasite_free          (GimpParasite       *parasite);
93 
94 GimpParasite * gimp_parasite_copy          (const GimpParasite *parasite);
95 
96 gboolean       gimp_parasite_compare       (const GimpParasite *a,
97                                             const GimpParasite *b);
98 
99 gboolean       gimp_parasite_is_type       (const GimpParasite *parasite,
100                                             const gchar        *name);
101 gboolean       gimp_parasite_is_persistent (const GimpParasite *parasite);
102 gboolean       gimp_parasite_is_undoable   (const GimpParasite *parasite);
103 gboolean       gimp_parasite_has_flag      (const GimpParasite *parasite,
104                                             gulong              flag);
105 gulong         gimp_parasite_flags         (const GimpParasite *parasite);
106 const gchar  * gimp_parasite_name          (const GimpParasite *parasite);
107 gconstpointer  gimp_parasite_data          (const GimpParasite *parasite);
108 glong          gimp_parasite_data_size     (const GimpParasite *parasite);
109 
110 
111 G_END_DECLS
112 
113 #endif /* __GIMP_PARASITE_H__ */
114