1 /* 2 * AnjutaPluginDescription - Plugin meta data 3 * anjuta-plugin-description.h Copyright (C) 2002 Red Hat, Inc. 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., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef ANJUTA_PLUGIN_PARSER_H 22 #define ANJUTA_PLUGIN_PARSER_H 23 24 #include <glib-object.h> 25 26 G_BEGIN_DECLS 27 28 #define ANJUTA_TYPE_PLUGIN_DESCRIPTION (anjuta_project_property_get_type ()) 29 #define ANJUTA_IS_PLUGIN_DESCIRPTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_PLUGIN_DESCRIPTION)) 30 31 typedef struct _AnjutaPluginDescription AnjutaPluginDescription; 32 33 typedef void (*AnjutaPluginDescriptionSectionFunc) (AnjutaPluginDescription *df, 34 const gchar *name, 35 gpointer user_data); 36 37 /* If @key is %NULL, @value is a comment line. */ 38 /* @value is raw, unescaped data. */ 39 typedef void (*AnjutaPluginDescriptionLineFunc) (AnjutaPluginDescription *df, 40 const gchar *key, 41 const gchar *locale, 42 const gchar *value, 43 gpointer data); 44 45 /** 46 * AnjutaPluginDescriptionParseError: 47 * @ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX: Syntax of plugin file is invalid 48 * @ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_ESCAPES: Invalid escape sequence 49 * @ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_CHARS: Invalid characters 50 * 51 * Possible errors when parsing a plugin file 52 */ 53 typedef enum 54 { 55 ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_SYNTAX, 56 ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_ESCAPES, 57 ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR_INVALID_CHARS 58 } AnjutaPluginDescriptionParseError; 59 60 #define ANJUTA_PLUGIN_DESCRIPTION_PARSE_ERROR \ 61 anjuta_plugin_description_parse_error_quark() 62 63 GQuark anjuta_plugin_description_parse_error_quark (void); 64 65 GType anjuta_plugin_description_get_type (void); 66 67 AnjutaPluginDescription* anjuta_plugin_description_new (const gchar *filename, 68 GError **error); 69 70 AnjutaPluginDescription* anjuta_plugin_description_new_from_string (gchar *data, 71 GError **error); 72 73 gchar* anjuta_plugin_description_to_string (AnjutaPluginDescription *df); 74 75 void anjuta_plugin_description_free (AnjutaPluginDescription *df); 76 AnjutaPluginDescription *anjuta_plugin_description_copy (AnjutaPluginDescription *df); 77 78 void anjuta_plugin_description_foreach_section (AnjutaPluginDescription *df, 79 AnjutaPluginDescriptionSectionFunc func, 80 gpointer user_data); 81 82 void anjuta_plugin_description_foreach_key (AnjutaPluginDescription *df, 83 const gchar *section_name, 84 gboolean include_localized, 85 AnjutaPluginDescriptionLineFunc func, 86 gpointer user_data); 87 88 /* Gets the raw text of the key, unescaped */ 89 gboolean anjuta_plugin_description_get_raw (AnjutaPluginDescription *df, 90 const gchar *section_name, 91 const gchar *keyname, 92 const gchar *locale, 93 gchar **val); 94 95 gboolean anjuta_plugin_description_get_integer (AnjutaPluginDescription *df, 96 const gchar *section, 97 const gchar *keyname, 98 gint *val); 99 100 gboolean anjuta_plugin_description_get_boolean (AnjutaPluginDescription *df, 101 const gchar *section, 102 const gchar *keyname, 103 gboolean *val); 104 105 gboolean anjuta_plugin_description_get_string (AnjutaPluginDescription *df, 106 const gchar *section, 107 const gchar *keyname, 108 gchar **val); 109 110 gboolean anjuta_plugin_description_get_locale_string (AnjutaPluginDescription *df, 111 const gchar *section, 112 const gchar *keyname, 113 gchar **val); 114 115 gboolean anjuta_plugin_description_override (AnjutaPluginDescription *df, 116 const gchar *section_name, 117 const gchar *keyname, 118 const gchar*val); 119 120 gboolean anjuta_plugin_description_remove (AnjutaPluginDescription *df, 121 const gchar *section_name, 122 const gchar *keyname); 123 G_END_DECLS 124 125 #endif /* ANJUTA_PLUGIN_PARSER_H */ 126