Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

config.h

Go to the documentation of this file.
00001 /* $Id: config.h,v 1.4 2004/04/04 20:40:00 murrayc Exp $ */
00002 // -*- C++ -*- //
00003 
00004 /* config.h
00005  *
00006  * Copyright 2003      libgdamm Development Team
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Library General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Library General Public
00019  * License along with this library; if not, write to the Free
00020  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021  */
00022 
00023 #ifndef _LIBGDAMM_CONFIG_H
00024 #define _LIBGDAMM_CONFIG_H
00025 
00026 #include <libgdamm/providerinfo.h>
00027 #include <libgdamm/datasourceinfo.h>
00028 #include <libgdamm/datamodel.h>
00029 #include <glibmm.h>
00030 
00031 namespace Gnome
00032 {
00033 
00034 namespace Gda
00035 {
00036 
00037 namespace Config
00038 {
00039 
00040 
00041 Glib::ustring get_value_string(const Glib::ustring& path);
00042 int get_value_int(const Glib::ustring& path);
00043 double get_value_float(const Glib::ustring& path);
00044 bool get_value_boolean(const Glib::ustring& path);
00045 void set_value(const Glib::ustring& path, const Glib::ustring& new_value);
00046 void set_value(const Glib::ustring& path, int new_value);
00047 void set_value(const Glib::ustring& path, double new_value);
00048 void set_value(const Glib::ustring& path, bool new_value);
00049 
00050 void remove_section(const Glib::ustring& path);
00051 void remove_key(const Glib::ustring& path);
00052 bool has_section(const Glib::ustring& path);
00053 bool has_key(const Glib::ustring& path);
00054 
00055 Glib::ListHandle<Glib::ustring> list_sections(const Glib::ustring& path);
00056 Glib::ListHandle<Glib::ustring> list_keys(const Glib::ustring& path);
00057 Glib::ustring get_type(const Glib::ustring& path);
00058 
00059 
00061 typedef sigc::slot<void, const Glib::ustring&> SlotListener;
00062 
00063 guint add_listener(const Glib::ustring& path, const SlotListener& slot);
00064 void remove_listener(guint id);
00065 
00066 struct ProviderInfoTraits
00067 {
00068   typedef Gnome::Gda::ProviderInfo       CppType;
00069   typedef const GdaProviderInfo*  CType;
00070   typedef GdaProviderInfo*        CTypeNonConst;
00071 
00072   static CType   to_c_type      (const CppType& obj) { return obj.gobj(); }
00073   static CType   to_c_type      (CType ptr) { return ptr; }
00074   static CppType to_cpp_type    (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); }
00075   static void    release_c_type (CType ptr) { gda_provider_info_free(const_cast<CTypeNonConst>(ptr)); }
00076 };
00077 
00078 typedef Glib::ListHandle<ProviderInfo, ProviderInfoTraits> ListHandle_ProviderInfo;
00079 ListHandle_ProviderInfo get_providers();
00080 
00081 ProviderInfo get_provider_by_name(const Glib::ustring& name);
00082 
00083 struct DataSourceInfoTraits
00084 {
00085   typedef Gnome::Gda::DataSourceInfo       CppType;
00086   typedef const GdaDataSourceInfo*  CType;
00087   typedef GdaDataSourceInfo*        CTypeNonConst;
00088 
00089   static CType   to_c_type      (const CppType& obj) { return obj.gobj(); }
00090   static CType   to_c_type      (CType ptr) { return ptr; }
00091   static CppType to_cpp_type    (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); }
00092   static void    release_c_type (CType ptr) { gda_config_free_data_source_info(const_cast<CTypeNonConst>(ptr)); }
00093 };
00094 
00095 
00096 typedef Glib::ListHandle<DataSourceInfo, DataSourceInfoTraits> ListHandle_DataSourceInfo;
00097 ListHandle_DataSourceInfo get_data_sources();
00098 
00099 DataSourceInfo find_data_source(const Glib::ustring& name);
00100 
00101 Glib::RefPtr<DataModel> get_data_source_model();
00102 void save_data_source(const Glib::ustring& name, const Glib::ustring& provider,
00103                       const Glib::ustring& cnc_string, const Glib::ustring& description,
00104                       const Glib::ustring& username, const Glib::ustring& password);
00105 void save_data_source(const DataSourceInfo& dsn_info);
00106 void remove_data_source(const Glib::ustring& name);
00107 
00108 
00109 } // namespace Config
00110 
00111 } // namespace Gda
00112 } // namespace Gnome
00113 
00114 
00115 #endif /* _LIBGDAMM_CONFIG_H */
00116 

Generated on Sat Jul 30 08:14:35 2005 for libgdamm by  doxygen 1.4.4