00001
00002
00003 #ifndef _LIBGDAMM_DATAMODELQUERY_H
00004 #define _LIBGDAMM_DATAMODELQUERY_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include <glibmm/object.h>
00032 #include <libgdamm/object.h>
00033 #include <libgdamm/datamodel.h>
00034 #include <libgdamm/parameterlist.h>
00035 #include <libgdamm/query.h>
00036
00037
00038 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00039 typedef struct _GdaDataModelQuery GdaDataModelQuery;
00040 typedef struct _GdaDataModelQueryClass GdaDataModelQueryClass;
00041 #endif
00042
00043
00044 namespace Gnome
00045 {
00046
00047 namespace Gda
00048 { class DataModelQuery_Class; }
00049
00050 }
00051 namespace Gnome
00052 {
00053
00054 namespace Gda
00055 {
00056
00059 class DataModelQueryError : public Glib::Error
00060 {
00061 public:
00062 enum Code
00063 {
00064 DATA_MODEL_QUERY_XML_LOAD_ERROR,
00065 DATA_MODEL_QUERY_COMPUTE_MODIF_QUERIES_ERROR
00066 };
00067
00068 DataModelQueryError(Code error_code, const Glib::ustring& error_message);
00069 explicit DataModelQueryError(GError* gobject);
00070 Code code() const;
00071
00072 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00073 private:
00074
00075 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00076 static void throw_func(GError* gobject);
00077 #else
00078
00079 static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
00080 #endif //GLIBMM_EXCEPTIONS_ENABLED
00081
00082 friend void wrap_init();
00083 #endif
00084 };
00085
00086 }
00087
00088 }
00089
00090 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00091 namespace Glib
00092 {
00093
00094 template <>
00095 class Value<Gnome::Gda::DataModelQueryError::Code> : public Glib::Value_Enum<Gnome::Gda::DataModelQueryError::Code>
00096 {
00097 public:
00098 static GType value_type() G_GNUC_CONST;
00099 };
00100
00101 }
00102 #endif
00103
00104
00105 namespace Gnome
00106 {
00107
00108 namespace Gda
00109 {
00110
00111
00125 enum DataModelQueryOptions
00126 {
00127 DATA_MODEL_QUERY_OPTION_USE_ALL_FIELDS_IF_NO_PK = 1 << 0
00128 };
00129
00131 inline DataModelQueryOptions operator|(DataModelQueryOptions lhs, DataModelQueryOptions rhs)
00132 { return static_cast<DataModelQueryOptions>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00133
00135 inline DataModelQueryOptions operator&(DataModelQueryOptions lhs, DataModelQueryOptions rhs)
00136 { return static_cast<DataModelQueryOptions>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00137
00139 inline DataModelQueryOptions operator^(DataModelQueryOptions lhs, DataModelQueryOptions rhs)
00140 { return static_cast<DataModelQueryOptions>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00141
00143 inline DataModelQueryOptions operator~(DataModelQueryOptions flags)
00144 { return static_cast<DataModelQueryOptions>(~static_cast<unsigned>(flags)); }
00145
00147 inline DataModelQueryOptions& operator|=(DataModelQueryOptions& lhs, DataModelQueryOptions rhs)
00148 { return (lhs = static_cast<DataModelQueryOptions>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00149
00151 inline DataModelQueryOptions& operator&=(DataModelQueryOptions& lhs, DataModelQueryOptions rhs)
00152 { return (lhs = static_cast<DataModelQueryOptions>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00153
00155 inline DataModelQueryOptions& operator^=(DataModelQueryOptions& lhs, DataModelQueryOptions rhs)
00156 { return (lhs = static_cast<DataModelQueryOptions>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00157
00158 }
00159
00160 }
00161
00162
00163 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00164 namespace Glib
00165 {
00166
00167 template <>
00168 class Value<Gnome::Gda::DataModelQueryOptions> : public Glib::Value_Flags<Gnome::Gda::DataModelQueryOptions>
00169 {
00170 public:
00171 static GType value_type() G_GNUC_CONST;
00172 };
00173
00174 }
00175 #endif
00176
00177
00178 namespace Gnome
00179 {
00180
00181 namespace Gda
00182 {
00183
00184
00193 class DataModelQuery
00194 : public Object,
00195 public DataModel
00196 {
00197
00198 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00199
00200 public:
00201 typedef DataModelQuery CppObjectType;
00202 typedef DataModelQuery_Class CppClassType;
00203 typedef GdaDataModelQuery BaseObjectType;
00204 typedef GdaDataModelQueryClass BaseClassType;
00205
00206 private: friend class DataModelQuery_Class;
00207 static CppClassType datamodelquery_class_;
00208
00209 private:
00210
00211 DataModelQuery(const DataModelQuery&);
00212 DataModelQuery& operator=(const DataModelQuery&);
00213
00214 protected:
00215 explicit DataModelQuery(const Glib::ConstructParams& construct_params);
00216 explicit DataModelQuery(GdaDataModelQuery* castitem);
00217
00218 #endif
00219
00220 public:
00221 virtual ~DataModelQuery();
00222
00223 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00224 static GType get_type() G_GNUC_CONST;
00225 static GType get_base_type() G_GNUC_CONST;
00226 #endif
00227
00229 GdaDataModelQuery* gobj() { return reinterpret_cast<GdaDataModelQuery*>(gobject_); }
00230
00232 const GdaDataModelQuery* gobj() const { return reinterpret_cast<GdaDataModelQuery*>(gobject_); }
00233
00235 GdaDataModelQuery* gobj_copy();
00236
00237 private:
00238
00239
00240 protected:
00241
00242
00243 explicit DataModelQuery(const Glib::RefPtr<Query>& query);
00244
00245
00246 public:
00247
00248 static Glib::RefPtr<DataModelQuery> create(Glib::RefPtr<Query>& query);
00249
00250
00255 Glib::RefPtr<ParameterList> get_parameter_list();
00256
00261 Glib::RefPtr<const ParameterList> get_parameter_list() const;
00262
00263
00268 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00269 bool query_refresh();
00270 #else
00271 bool query_refresh(std::auto_ptr<Glib::Error>& error);
00272 #endif //GLIBMM_EXCEPTIONS_ENABLED
00273
00274
00294 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00295 bool set_modification_query(const Glib::ustring& query);
00296 #else
00297 bool set_modification_query(const Glib::ustring& query, std::auto_ptr<Glib::Error>& error);
00298 #endif //GLIBMM_EXCEPTIONS_ENABLED
00299
00300
00313 #ifdef GLIBMM_EXCEPTIONS_ENABLED
00314 bool compute_modification_queries(const Glib::ustring& target, DataModelQueryOptions options);
00315 #else
00316 bool compute_modification_queries(const Glib::ustring& target, DataModelQueryOptions options, std::auto_ptr<Glib::Error>& error);
00317 #endif //GLIBMM_EXCEPTIONS_ENABLED
00318
00319
00320 public:
00321
00322 public:
00323
00324 #ifdef GLIBMM_VFUNCS_ENABLED
00325 #endif //GLIBMM_VFUNCS_ENABLED
00326
00327 protected:
00328
00329 #ifdef GLIBMM_VFUNCS_ENABLED
00330 #endif //GLIBMM_VFUNCS_ENABLED
00331
00332
00333 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00334 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00335
00336
00337 };
00338
00339 }
00340 }
00341
00342
00343 namespace Glib
00344 {
00350 Glib::RefPtr<Gnome::Gda::DataModelQuery> wrap(GdaDataModelQuery* object, bool take_copy = false);
00351 }
00352
00353
00354 #endif
00355