2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = libgda-gda-config.html
51 * - GdaDataSourceInfo -> DataSourceInfo
62 import tango
.io
.Stdout
; // use the tango loging?
66 private import gdac
.gdatypes
;
68 private import gdac
.gda
;
71 private import glib
.ListG
;
78 * The functions in this section allow applications an easy access to the libgda
79 * configuration, thus making them able to access the list of data sources
80 * configured in the system, for instance.
89 * Gets the value of the specified configuration entry as a string. You
90 * are then responsible to free the returned string.
92 * path to the configuration entry.
94 * the value stored at the given entry.
96 public static char[] getString(char[] path
)
98 // gchar* gda_config_get_string (const gchar *path);
99 return Str
.toString(gda_config_get_string(Str
.toStringz(path
)) );
103 * Gets the value of the specified configuration entry as an integer.
105 * path to the configuration entry.
107 * the value stored at the given entry.
109 public static int getInt(char[] path
)
111 // gint gda_config_get_int (const gchar *path);
112 return gda_config_get_int(Str
.toStringz(path
));
116 * Gets the value of the specified configuration entry as a float.
118 * path to the configuration entry.
120 * the value stored at the given entry.
122 public static double getFloat(char[] path
)
124 // gdouble gda_config_get_float (const gchar *path);
125 return gda_config_get_float(Str
.toStringz(path
));
129 * Gets the value of the specified configuration entry as a boolean.
131 * path to the configuration entry.
133 * the value stored at the given entry.
135 public static int getBoolean(char[] path
)
137 // gboolean gda_config_get_boolean (const gchar *path);
138 return gda_config_get_boolean(Str
.toStringz(path
));
142 * Sets the given configuration entry to contain a string.
144 * path to the configuration entry.
148 public static void setString(char[] path
, char[] newValue
)
150 // void gda_config_set_string (const gchar *path, const gchar *new_value);
151 gda_config_set_string(Str
.toStringz(path
), Str
.toStringz(newValue
));
155 * Sets the given configuration entry to contain an integer.
157 * path to the configuration entry.
161 public static void setInt(char[] path
, int newValue
)
163 // void gda_config_set_int (const gchar *path, gint new_value);
164 gda_config_set_int(Str
.toStringz(path
), newValue
);
168 * Sets the given configuration entry to contain a float.
170 * path to the configuration entry.
174 public static void setFloat(char[] path
, double newValue
)
176 // void gda_config_set_float (const gchar *path, gdouble new_value);
177 gda_config_set_float(Str
.toStringz(path
), newValue
);
181 * Sets the given configuration entry to contain a boolean.
183 * path to the configuration entry.
187 public static void setBoolean(char[] path
, int newValue
)
189 // void gda_config_set_boolean (const gchar *path, gboolean new_value);
190 gda_config_set_boolean(Str
.toStringz(path
), newValue
);
194 * Removes the given section from the configuration database.
196 * path to the configuration section.
198 public static void removeSection(char[] path
)
200 // void gda_config_remove_section (const gchar *path);
201 gda_config_remove_section(Str
.toStringz(path
));
205 * Removes the given entry from the configuration database.
206 * If the section is empty, also remove the section.
208 * path to the configuration entry.
210 public static void removeKey(char[] path
)
212 // void gda_config_remove_key (const gchar *path);
213 gda_config_remove_key(Str
.toStringz(path
));
217 * Checks whether the given section exists in the configuration
220 * path to the configuration section.
222 * TRUE if the section exists, FALSE otherwise.
224 public static int hasSection(char[] path
)
226 // gboolean gda_config_has_section (const gchar *path);
227 return gda_config_has_section(Str
.toStringz(path
));
231 * Checks whether the given key exists in the configuration system.
233 * path to the configuration key.
235 * TRUE if the entry exists, FALSE otherwise.
237 public static int hasKey(char[] path
)
239 // gboolean gda_config_has_key (const gchar *path);
240 return gda_config_has_key(Str
.toStringz(path
));
244 * Returns a GList containing the names of all the sections available
245 * under the given root directory.
246 * To free the returned value, you can use gda_config_free_list.
250 * a list containing all the section names.
252 public static ListG
listSections(char[] path
)
254 // GList* gda_config_list_sections (const gchar *path);
255 return new ListG( gda_config_list_sections(Str
.toStringz(path
)) );
259 * Returns a list of all keys that exist under the given path.
260 * To free the returned value, you can use gda_config_free_list.
264 * a list containing all the key names.
266 public static ListG
listKeys(char[] path
)
268 // GList* gda_config_list_keys (const gchar *path);
269 return new ListG( gda_config_list_keys(Str
.toStringz(path
)) );
273 * Gets a string representing the type of the value of the given key.
274 * The caller is responsible of freeing the returned value.
276 * path to the configuration key.
278 * NULL if not found. Otherwise: "string", "float", "long", "bool".
280 public static char[] getType(char[] path
)
282 // gchar* gda_config_get_type (const gchar *path);
283 return Str
.toString(gda_config_get_type(Str
.toStringz(path
)) );
287 * Frees all memory used by the given GList, which must be the return value
288 * from either gda_config_list_sections and gda_config_list_keys.
292 public static void freeList(ListG list
)
294 // void gda_config_free_list (GList *list);
295 gda_config_free_list((list
is null) ?
null : list
.getListGStruct());
300 * Installs a configuration listener, which is a callback function
301 * which will be called every time a change occurs on a given
302 * configuration entry.
304 * configuration path to listen to.
308 * data to be passed to the callback function.
310 * the ID of the listener, which you will need for
311 * calling gda_config_remove_listener. If an error occurs,
314 public static uint addListener(char[] path
, GdaConfigListenerFunc func
, void* userData
)
316 // guint gda_config_add_listener (const gchar *path, GdaConfigListenerFunc func, gpointer user_data);
317 return gda_config_add_listener(Str
.toStringz(path
), func
, userData
);
321 * Removes a configuration listener previously installed with
322 * gda_config_add_listener, given its ID.
324 * the ID of the listener to remove.
326 public static void removeListener(uint id
)
328 // void gda_config_remove_listener (guint id);
329 gda_config_remove_listener(id
);
338 * Returns a list of all providers currently installed in
339 * the system. Each of the nodes in the returned GList
340 * is a GdaProviderInfo. To free the returned list,
341 * call the gda_config_free_provider_list function.
343 * a GList of GdaProviderInfo structures.
345 public static ListG
getProviderList()
347 // GList* gda_config_get_provider_list (void);
348 return new ListG( gda_config_get_provider_list() );
352 * Frees a list of GdaProviderInfo structures.
354 * the list to be freed.
356 public static void freeProviderList(ListG list
)
358 // void gda_config_free_provider_list (GList *list);
359 gda_config_free_provider_list((list
is null) ?
null : list
.getListGStruct());
363 * Gets a GdaProviderInfo structure from the provider list given its name.
365 * name of the provider to search for.
367 * a GdaProviderInfo structure, if found, or NULL if not found.
369 public static GdaProviderInfo
* getProviderByName(char[] name
)
371 // GdaProviderInfo* gda_config_get_provider_by_name (const gchar *name);
372 return gda_config_get_provider_by_name(Str
.toStringz(name
));
376 * Fills and returns a new GdaDataModel object using information from all
377 * providers which are currently installed in the system.
378 * Rows are separated in 3 columns:
379 * 'Id', 'Location' and 'Description'.
381 * a new GdaDataModel object.
383 public static GdaDataModel
* getProviderModel()
385 // GdaDataModel* gda_config_get_provider_model (void);
386 return gda_config_get_provider_model();
393 * Creates a new GdaDataSourceInfo structure from an existing one.
395 * data source information to get a copy from.
397 * a newly allocated GdaDataSourceInfo with contains a copy of
398 * information in src.
400 public static GdaDataSourceInfo
* copyDataSourceInfo(GdaDataSourceInfo
* src
)
402 // GdaDataSourceInfo* gda_config_copy_data_source_info (GdaDataSourceInfo *src);
403 return gda_config_copy_data_source_info(src
);
407 * Deallocates all memory associated to the given GdaDataSourceInfo.
409 * data source information to free.
411 public static void freeDataSourceInfo(GdaDataSourceInfo
* info
)
413 // void gda_config_free_data_source_info (GdaDataSourceInfo *info);
414 gda_config_free_data_source_info(info
);
418 * Returns a list of all data sources currently configured in the system.
419 * Each of the nodes in the returned GList is a GdaDataSourceInfo.
420 * To free the returned list, call the gda_config_free_data_source_list
423 * a GList of GdaDataSourceInfo structures.
425 public static ListG
getDataSourceList()
427 // GList* gda_config_get_data_source_list (void);
428 return new ListG( gda_config_get_data_source_list() );
432 * Gets a GdaDataSourceInfo structure from the data source list given its
435 * name of the data source to search for.
437 * a GdaDataSourceInfo structure, if found, or NULL if not found.
439 public static GdaDataSourceInfo
* findDataSource(char[] name
)
441 // GdaDataSourceInfo* gda_config_find_data_source (const gchar *name);
442 return gda_config_find_data_source(Str
.toStringz(name
));
446 * Frees a list of GdaDataSourceInfo structures.
448 * the list to be freed.
450 public static void freeDataSourceList(ListG list
)
452 // void gda_config_free_data_source_list (GList *list);
453 gda_config_free_data_source_list((list
is null) ?
null : list
.getListGStruct());
457 * Fills and returns a new GdaDataModel object using information from all
458 * data sources which are currently configured in the system.
459 * Rows are separated in 6 columns:
460 * 'Name', 'Provider', 'Connection string', 'Description', 'Username' and
463 * a new GdaDataModel object.
465 public static GdaDataModel
* getDataSourceModel()
467 // GdaDataModel* gda_config_get_data_source_model (void);
468 return gda_config_get_data_source_model();
472 * Adds a new data source (or update an existing one) to the GDA
473 * configuration, based on the parameters given.
475 * name for the data source to be saved.
477 * provider ID for the new data source.
479 * connection string for the new data source.
481 * description for the new data source.
483 * user name for the new data source.
485 * password to use when authenticating username.
487 public static void saveDataSource(char[] name
, char[] provider
, char[] cncString
, char[] description
, char[] username
, char[] password
)
489 // void gda_config_save_data_source (const gchar *name, const gchar *provider, const gchar *cnc_string, const gchar *description, const gchar *username, const gchar *password);
490 gda_config_save_data_source(Str
.toStringz(name
), Str
.toStringz(provider
), Str
.toStringz(cncString
), Str
.toStringz(description
), Str
.toStringz(username
), Str
.toStringz(password
));
494 * Saves a data source in the libgda configuration given a
495 * GdaDataSourceInfo structure containing all the information
496 * about the data source.
498 * a GdaDataSourceInfo structure.
500 public static void saveDataSourceInfo(GdaDataSourceInfo
* dsnInfo
)
502 // void gda_config_save_data_source_info (GdaDataSourceInfo *dsn_info);
503 gda_config_save_data_source_info(dsnInfo
);
507 * Removes the given data source from the GDA configuration.
509 * name for the data source to be removed.
511 public static void removeDataSource(char[] name
)
513 // void gda_config_remove_data_source (const gchar *name);
514 gda_config_remove_data_source(Str
.toStringz(name
));