Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / rdf.h
1 /** @file
2  * @brief headers for RDF types
3  */
4 /* Authors:
5  *  Kees Cook <kees@outflux.net>
6  *  Jon A. Cruz <jon@joncruz.org>
7  *
8  * Copyright (C) 2004 Authors
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
11 #ifndef SEEN_RDF_H
12 #define SEEN_RDF_H
14 #include <glib.h>
15 #include <glibmm/i18n.h>
16 #include "document.h"
18 // yeah, it's not a triple yet...
19 /**
20  * \brief Holds license name/resource doubles for rdf_license_t entries
21  */
22 struct rdf_double_t {
23     gchar const *name;
24     gchar const *resource;
25 };
27 /**
28  * \brief Holds license name and RDF information
29  */
30 struct rdf_license_t {
31     gchar const *name;        /* localized name of this license */
32     gchar const *uri;         /* URL for the RDF/Work/license element */
33     struct rdf_double_t *details; /* the license details */
34 //    gchar const *fragment;    /* XML contents for the RDF/License tag */
35 };
37 extern rdf_license_t rdf_licenses [];
39 /**
40  * \brief Describes how a given RDF entity is stored in XML
41  */
42 enum RDFType {
43     RDF_CONTENT,  // direct between-XML-tags content
44     RDF_AGENT,    // requires the "Agent" hierarchy before doing content
45     RDF_RESOURCE, // stored in "rdf:resource" element
46     RDF_XML,      // literal XML
47     RDF_BAG       // rdf:Bag resources
48 };
50 /**
51  * \brief Describes how a given RDF entity should be edited
52  */
53 enum RDF_Format {
54     RDF_FORMAT_LINE,          // uses single line data (GtkEntry)
55     RDF_FORMAT_MULTILINE,     // uses multiline data (GtkTextView)
56     RDF_FORMAT_SPECIAL        // uses some other edit methods
57 };
59 enum RDF_Editable {
60     RDF_EDIT_GENERIC,       // editable via generic widgets
61     RDF_EDIT_SPECIAL,       // special widgets are needed
62     RDF_EDIT_HARDCODED      // isn't editable
63 };
65 /**
66  * \brief Holds known RDF/Work tags
67  */
68 struct rdf_work_entity_t {
69     char const *name;       /* unique name of this entity for internal reference */
70     gchar const *title;      /* localized title of this entity for data entry */
71     gchar const *tag;        /* namespace tag for the RDF/Work element */
72     RDFType datatype;   /* how to extract/inject the RDF information */
73     gchar const *tip;        /* tool tip to explain the meaning of the entity */
74     RDF_Format format;  /* in what format is this data edited? */
75     RDF_Editable editable;/* in what way is the data editable? */
76 };
78 extern rdf_work_entity_t rdf_work_entities [];
80 /**
81  * \brief Generic collection of RDF information for the RDF debug function
82  */
83 struct rdf_t {
84     gchar*                work_title;
85     gchar*                work_date;
86     gchar*                work_creator;
87     gchar*                work_owner;
88     gchar*                work_publisher;
89     gchar*                work_type;
90     gchar*                work_source;
91     gchar*                work_subject;
92     gchar*                work_description;
93     struct rdf_license_t* license;
94 };
96 struct rdf_work_entity_t * rdf_find_entity(gchar const * name);
98 /**
99  *  \brief   Retrieves a known RDF/Work entity's contents from the document XML by name
100  *  \return  A pointer to the entity's static contents as a string, or NULL if no entity exists
101  *  \param   entity  The desired RDF/Work entity
102  *  
103  */
104 const gchar * rdf_get_work_entity(SPDocument const * doc,
105                                   struct rdf_work_entity_t * entity);
107 /**
108  *  \brief   Stores a string into a named RDF/Work entity in the document XML
109  *  \param   entity The desired RDF/Work entity to replace
110  *  \param   string The string to replace the entity contents with
111  *  
112  */
113 unsigned int  rdf_set_work_entity(SPDocument * doc,
114                                   struct rdf_work_entity_t * entity,
115                                   const gchar * text);
117 /**
118  *  \brief   Attempts to match and retrieve a known RDF/License from the document XML
119  *  \return  A pointer to the static RDF license structure
120  *  
121  */
122 struct rdf_license_t * rdf_get_license(SPDocument const * doc);
124 /**
125  *  \brief   Stores an RDF/License XML in the document XML
126  *  \param   document  Which document to update
127  *  \param   license   The desired RDF/License structure to store; NULL drops old license, so can be used for proprietary license. 
128  *  
129  */
130 void                   rdf_set_license(SPDocument * doc,
131                                        struct rdf_license_t const * license);
133 void rdf_set_defaults ( SPDocument * doc );
135 #endif // SEEN_RDF_H
137 /*
138   Local Variables:
139   mode:c++
140   c-file-style:"stroustrup"
141   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
142   indent-tabs-mode:nil
143   fill-column:99
144   End:
145 */
146 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :