00001
00002
00003 #ifndef _LIBGDAMM_COMMAND_H
00004 #define _LIBGDAMM_COMMAND_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
00033
00034 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00035 extern "C" { typedef struct _GdaCommand GdaCommand; }
00036 #endif
00037
00038 namespace Gnome
00039 {
00040
00041 namespace Gda
00042 {
00043
00049 enum CommandType
00050 {
00051 COMMAND_TYPE_SQL,
00052 COMMAND_TYPE_XML,
00053 COMMAND_TYPE_PROCEDURE,
00054 COMMAND_TYPE_TABLE,
00055 COMMAND_TYPE_SCHEMA,
00056 COMMAND_TYPE_INVALID
00057 };
00058
00059 }
00060
00061 }
00062
00063
00064 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00065 namespace Glib
00066 {
00067
00068 template <>
00069 class Value<Gnome::Gda::CommandType> : public Glib::Value_Enum<Gnome::Gda::CommandType>
00070 {
00071 public:
00072 static GType value_type() G_GNUC_CONST;
00073 };
00074
00075 }
00076 #endif
00077
00078
00079 namespace Gnome
00080 {
00081
00082 namespace Gda
00083 {
00084
00096 enum CommandOptions
00097 {
00098 COMMAND_OPTION_IGNORE_ERRORS = 1,
00099 COMMAND_OPTION_STOP_ON_ERRORS = 1 << 1,
00100 COMMAND_OPTION_BAD_OPTION = 1 << 2
00101 };
00102
00104 inline CommandOptions operator|(CommandOptions lhs, CommandOptions rhs)
00105 { return static_cast<CommandOptions>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00106
00108 inline CommandOptions operator&(CommandOptions lhs, CommandOptions rhs)
00109 { return static_cast<CommandOptions>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00110
00112 inline CommandOptions operator^(CommandOptions lhs, CommandOptions rhs)
00113 { return static_cast<CommandOptions>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00114
00116 inline CommandOptions operator~(CommandOptions flags)
00117 { return static_cast<CommandOptions>(~static_cast<unsigned>(flags)); }
00118
00120 inline CommandOptions& operator|=(CommandOptions& lhs, CommandOptions rhs)
00121 { return (lhs = static_cast<CommandOptions>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00122
00124 inline CommandOptions& operator&=(CommandOptions& lhs, CommandOptions rhs)
00125 { return (lhs = static_cast<CommandOptions>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00126
00128 inline CommandOptions& operator^=(CommandOptions& lhs, CommandOptions rhs)
00129 { return (lhs = static_cast<CommandOptions>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00130
00131 }
00132
00133 }
00134
00135
00136 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00137 namespace Glib
00138 {
00139
00140 template <>
00141 class Value<Gnome::Gda::CommandOptions> : public Glib::Value_Flags<Gnome::Gda::CommandOptions>
00142 {
00143 public:
00144 static GType value_type() G_GNUC_CONST;
00145 };
00146
00147 }
00148 #endif
00149
00150
00151 namespace Gnome
00152 {
00153
00154 namespace Gda
00155 {
00156
00157
00173 class Command
00174 {
00175 public:
00176 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00177 typedef Command CppObjectType;
00178 typedef GdaCommand BaseObjectType;
00179 #endif
00180
00181 Command();
00182
00183
00184 explicit Command(GdaCommand* castitem, bool make_a_copy = false);
00185
00186 Command(const Command& src);
00187 Command& operator=(const Command& src);
00188
00189 ~Command();
00190
00191 GdaCommand* gobj() { return gobject_; }
00192 const GdaCommand* gobj() const { return gobject_; }
00193
00195 GdaCommand* gobj_copy() const;
00196
00197 protected:
00198 GdaCommand* gobject_;
00199
00200 private:
00201
00202
00203 public:
00204
00205
00212 explicit Command(const Glib::ustring& text, CommandType type = COMMAND_TYPE_SQL, CommandOptions options = COMMAND_OPTION_STOP_ON_ERRORS);
00213
00214
00218 Glib::ustring get_text() const;
00219
00223 void set_text(const Glib::ustring& text);
00224
00228 CommandType get_command_type() const;
00229
00233 void set_command_type(CommandType type);
00234
00238 CommandOptions get_options() const;
00239
00244 void set_options(CommandOptions options);
00245
00246
00247 };
00248
00249 }
00250 }
00251
00252
00253 namespace Glib
00254 {
00255
00261 Gnome::Gda::Command wrap(GdaCommand* object, bool take_copy = false);
00262
00263 }
00264
00265
00266 #endif
00267