~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/metadata/xmp-parse.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* xmp-parse.h - simple parser for XMP metadata
 
2
 *
 
3
 * Copyright (C) 2004, Raphaël Quinet <raphael@gimp.org>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the
 
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#ifndef XMP_PARSE_H
 
22
#define XMP_PARSE_H
 
23
 
 
24
#include <glib.h>
 
25
 
 
26
G_BEGIN_DECLS
 
27
 
 
28
typedef enum
 
29
{
 
30
  XMP_ERROR_NO_XPACKET,
 
31
  XMP_ERROR_BAD_ENCODING,
 
32
  XMP_ERROR_PARSE,
 
33
  XMP_ERROR_MISSING_ABOUT,
 
34
  XMP_ERROR_UNKNOWN_ELEMENT,
 
35
  XMP_ERROR_UNKNOWN_ATTRIBUTE,
 
36
  XMP_ERROR_UNEXPECTED_ELEMENT,
 
37
  XMP_ERROR_INVALID_CONTENT,
 
38
  XMP_ERROR_INVALID_COMMENT
 
39
} XMPParseError;
 
40
 
 
41
#define XMP_PARSE_ERROR xmp_parse_error_quark ()
 
42
 
 
43
GQuark xmp_parse_error_quark (void);
 
44
 
 
45
typedef enum
 
46
{
 
47
  XMP_FLAG_FIND_XPACKET           = 1 << 0, /* allow text before <?xpacket */
 
48
  XMP_FLAG_NO_COMMENTS            = 1 << 1, /* no XML comments allowed */
 
49
  XMP_FLAG_NO_UNKNOWN_ELEMENTS    = 1 << 2, /* no unknown XML elements */
 
50
  XMP_FLAG_NO_UNKNOWN_ATTRIBUTES  = 1 << 3, /* no unknown XML attributes */
 
51
  XMP_FLAG_NO_MISSING_ABOUT       = 1 << 4, /* schemas must have rdf:about */
 
52
  XMP_FLAG_DEFER_VALUE_FREE       = 1 << 5  /* prop. value[] freed by caller */
 
53
} XMPParseFlags;
 
54
 
 
55
typedef enum
 
56
{
 
57
  XMP_PTYPE_TEXT,           /* value in value[0] */
 
58
  XMP_PTYPE_RESOURCE,       /* value in value[0] */
 
59
  XMP_PTYPE_ORDERED_LIST,   /* values in value[0..n] */
 
60
  XMP_PTYPE_UNORDERED_LIST, /* values in value[0..n] */
 
61
  XMP_PTYPE_ALT_THUMBS,     /* values in value[0..n] */
 
62
  XMP_PTYPE_ALT_LANG,  /* lang in value[0,2..n*2], text in value[1,3..n*2+1] */
 
63
  XMP_PTYPE_STRUCTURE, /* ns prefix in name[0], ns uri in name[1], */
 
64
                    /* name in value[2,4..n*2+2], value in value[3,5..n*2+3] */
 
65
  XMP_PTYPE_UNKNOWN
 
66
} XMPParseType;
 
67
 
 
68
typedef struct _XMPParseContext XMPParseContext;
 
69
typedef struct _XMPParser XMPParser;
 
70
 
 
71
struct _XMPParser
 
72
{
 
73
  /* Called whenever the parser sees a new namespace (usually an XMP
 
74
   * schema) except for the basic RDF and XMP namespaces.  The value
 
75
   * returned by this callback will be passed as "ns_user_data" to the
 
76
   * callbacks end_schema and set_property.  It is allowed to return
 
77
   * the pointers ns_uri or ns_prefix because they will remain valid
 
78
   * at least until end_schema is called.
 
79
   */
 
80
  gpointer    (*start_schema)   (XMPParseContext     *context,
 
81
                                 const gchar         *ns_uri,
 
82
                                 const gchar         *ns_prefix,
 
83
                                 gpointer             user_data,
 
84
                                 GError             **error);
 
85
 
 
86
  /* Called when a namespace goes out of scope.  The ns_user_data will
 
87
   * be the one that was returned by start_schema for the
 
88
   * corresponding schema.
 
89
   */
 
90
  void        (*end_schema)     (XMPParseContext     *context,
 
91
                                 gpointer             ns_user_data,
 
92
                                 gpointer             user_data,
 
93
                                 GError             **error);
 
94
 
 
95
  /* Called for each property that is defined in the XMP packet.  The
 
96
   * way the value of the property is returned depends on its type.
 
97
   * See the definition of XMPParseType for details.
 
98
   */
 
99
  void        (*set_property)   (XMPParseContext     *context,
 
100
                                 const gchar         *name,
 
101
                                 XMPParseType         type,
 
102
                                 const gchar        **value,
 
103
                                 gpointer             ns_user_data,
 
104
                                 gpointer             user_data,
 
105
                                 GError             **error);
 
106
 
 
107
  /* Called on error, including one set by other methods in the
 
108
   * vtable.  The GError should not be freed.
 
109
   */
 
110
  void        (*error)          (XMPParseContext     *context,
 
111
                                 GError              *error,
 
112
                                 gpointer             user_data);
 
113
};
 
114
 
 
115
XMPParseContext * xmp_parse_context_new   (const XMPParser *parser,
 
116
                                           XMPParseFlags    flags,
 
117
                                           gpointer         user_data,
 
118
                                           GDestroyNotify   user_data_dnotify);
 
119
 
 
120
void              xmp_parse_context_free  (XMPParseContext *context);
 
121
 
 
122
gboolean          xmp_parse_context_parse (XMPParseContext *context,
 
123
                                           const gchar     *text,
 
124
                                           gssize           text_len,
 
125
                                           GError         **error);
 
126
 
 
127
gboolean          xmp_parse_context_end_parse (XMPParseContext  *context,
 
128
                                               GError          **error);
 
129
G_END_DECLS
 
130
 
 
131
#endif /* XMP_PARSE_H */