1 /***************************************************************************
2  $RCSfile$
3                              -------------------
4     cvs         : $Id$
5     begin       : Fri Sep 12 2003
6     copyright   : (C) 2003 by Martin Preuss
7     email       : martin@libchipcard.de
8 
9  ***************************************************************************
10  *                                                                         *
11  *   This library is free software; you can redistribute it and/or         *
12  *   modify it under the terms of the GNU Lesser General Public            *
13  *   License as published by the Free Software Foundation; either          *
14  *   version 2.1 of the License, or (at your option) any later version.    *
15  *                                                                         *
16  *   This library is distributed in the hope that it will be useful,       *
17  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
19  *   Lesser General Public License for more details.                       *
20  *                                                                         *
21  *   You should have received a copy of the GNU Lesser General Public      *
22  *   License along with this library; if not, write to the Free Software   *
23  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
24  *   MA  02111-1307  USA                                                   *
25  *                                                                         *
26  ***************************************************************************/
27 
28 
29 #ifndef GWENHYWFAR_PLUGINDESCR_H
30 #define GWENHYWFAR_PLUGINDESCR_H
31 
32 #include <gwenhywfar/gwenhywfarapi.h>
33 #include <gwenhywfar/misc.h>
34 #include <gwenhywfar/misc2.h>
35 #include <gwenhywfar/xml.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 typedef struct GWEN_PLUGIN_DESCRIPTION GWEN_PLUGIN_DESCRIPTION;
42 
43 GWEN_LIST_FUNCTION_LIB_DEFS(GWEN_PLUGIN_DESCRIPTION, GWEN_PluginDescription, GWENHYWFAR_API)
44 GWEN_LIST2_FUNCTION_LIB_DEFS(GWEN_PLUGIN_DESCRIPTION, GWEN_PluginDescription, GWENHYWFAR_API)
45 /* Do not terminate these lines with semicolon because they are
46    macros, not functions, and ISO C89 does not allow a semicolon
47    there. */
48 
49 GWENHYWFAR_API
50 void GWEN_PluginDescription_List2_freeAll(GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl);
51 
52 
53 GWENHYWFAR_API
54 GWEN_PLUGIN_DESCRIPTION_LIST2 *GWEN_LoadPluginDescrs(const char *path);
55 
56 
57 /**
58  * Loads a list of plugins descriptions.
59  * When parsing the description files entries for the current language will
60  * be selected. The current language can be set via @ref GWEN_I18N_SetLocale.
61  * @param path folder to search for XML files
62  * @param type plugin type (property "type" of tag "plugin")
63  * @param pdl plugin descriptions list2 to load descriptions to
64  */
65 GWENHYWFAR_API
66 int GWEN_LoadPluginDescrsByType(const char *path,
67                                 const char *type,
68                                 GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl);
69 
70 
71 GWENHYWFAR_API
72 void GWEN_PluginDescription_free(GWEN_PLUGIN_DESCRIPTION *pd);
73 
74 
75 GWENHYWFAR_API
76 GWEN_PLUGIN_DESCRIPTION *
77 GWEN_PluginDescription_dup(const GWEN_PLUGIN_DESCRIPTION *pd);
78 
79 GWENHYWFAR_API
80 void GWEN_PluginDescription_Attach(GWEN_PLUGIN_DESCRIPTION *pd);
81 
82 
83 /**
84  * Returns the XML node this description consists of (the "plugin" node).
85  * It may contain additional information used by programs.
86  * This function does not relinquish ownership of the returned pointer,
87  * so you MUST NOT free it. As soon as the description itself is destroyed
88  * this XML node will be, too. So you have to call GWEN_XMLNode_dup() if
89  * you want the XML node to survive the description.
90  */
91 GWENHYWFAR_API
92 GWEN_XMLNODE *
93 GWEN_PluginDescription_GetXmlNode(const GWEN_PLUGIN_DESCRIPTION *pd);
94 
95 GWENHYWFAR_API
96 const char *GWEN_PluginDescription_GetPath(const GWEN_PLUGIN_DESCRIPTION *pd);
97 
98 GWENHYWFAR_API
99 void GWEN_PluginDescription_SetPath(GWEN_PLUGIN_DESCRIPTION *pd,
100                                     const char *s);
101 
102 GWENHYWFAR_API
103 const char *GWEN_PluginDescription_GetName(const GWEN_PLUGIN_DESCRIPTION *pd);
104 
105 GWENHYWFAR_API
106 const char *GWEN_PluginDescription_GetType(const GWEN_PLUGIN_DESCRIPTION *pd);
107 
108 GWENHYWFAR_API
109 const char *
110 GWEN_PluginDescription_GetShortDescr(const GWEN_PLUGIN_DESCRIPTION *pd);
111 
112 GWENHYWFAR_API
113 const char *
114 GWEN_PluginDescription_GetAuthor(const GWEN_PLUGIN_DESCRIPTION *pd);
115 
116 GWENHYWFAR_API
117 const char *
118 GWEN_PluginDescription_GetVersion(const GWEN_PLUGIN_DESCRIPTION *pd);
119 
120 GWENHYWFAR_API
121 const char *
122 GWEN_PluginDescription_GetLongDescr(const GWEN_PLUGIN_DESCRIPTION *pd);
123 
124 GWENHYWFAR_API
125 const char *
126 GWEN_PluginDescription_GetFileName(const GWEN_PLUGIN_DESCRIPTION *pd);
127 
128 GWENHYWFAR_API
129 void GWEN_PluginDescription_SetFileName(GWEN_PLUGIN_DESCRIPTION *pd,
130                                         const char *s);
131 
132 
133 
134 #ifndef NO_DEPRECATED_SYMBOLS
135 /**
136  * <p>
137  * Seeks for a long description with the given format and the currently
138  * selected locale and appends it to the data in the given buffer.
139  * </p>
140  * <p>
141  * The DESCR tag of the plugin description is expected to contain sub tags
142  * named TEXT with the property "FORMAT" describing the format and "LANG"
143  * containing the language of the element.
144  * </p>
145  * <p>
146  * Currently supported format is "html".
147  * </p>
148  * @return 0 if ok, !=0 on error
149  * @param pd plugin description
150  * @param s name of the format (e.g. <i>html</i>)
151  * @param buf buffer to append the description to
152  */
153 GWENHYWFAR_API DEPRECATED
154 int
155 GWEN_PluginDescription_GetLongDescrByFormat(const GWEN_PLUGIN_DESCRIPTION *pd,
156                                             const char *s,
157                                             GWEN_BUFFER *buf);
158 #endif  // ifndef NO_DEPRECATED_SYMBOLS
159 
160 GWENHYWFAR_API
161 int GWEN_PluginDescription_IsActive(const GWEN_PLUGIN_DESCRIPTION *pd);
162 
163 GWENHYWFAR_API
164 void GWEN_PluginDescription_SetIsActive(GWEN_PLUGIN_DESCRIPTION *pd, int i);
165 
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 
172 #endif /* GWENHYWFAR_PLUGINDESCR_H */
173