command.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _LIBGDAMM_COMMAND_H
00004 #define _LIBGDAMM_COMMAND_H
00005 
00006 
00007 #include <glibmm.h>
00008 
00009 /* $Id: command.hg,v 1.6 2006/11/30 06:58:55 murrayc Exp $ */
00010 // -*- C++ -*- // this is for the .hg, I realize gensig puts one in
00011 
00012 /* command.h
00013  *
00014  * Copyright 2003 libgdamm Development Team
00015  *
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Library General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2 of the License, or (at your option) any later version.
00020  *
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Library General Public License for more details.
00025  *
00026  * You should have received a copy of the GNU Library General Public
00027  * License along with this library; if not, write to the Free
00028  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 } // namespace Gda
00060 
00061 } // namespace Gnome
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 } // namespace Glib
00076 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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 } // namespace Gda
00132 
00133 } // namespace Gnome
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 } // namespace Glib
00148 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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 /* DOXYGEN_SHOULD_SKIP_THIS */
00180 
00181   Command();
00182 
00183   // Use make_a_copy=true when getting it directly from a struct.
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   //TODO: What do the other command types do? How do they work?
00205 
00212   explicit Command(const Glib::ustring& text, CommandType type = COMMAND_TYPE_SQL, CommandOptions options = COMMAND_OPTION_STOP_ON_ERRORS); //TODO: Good defaults.
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 } // namespace Gda
00250 } // namespace Gnome
00251 
00252 
00253 namespace Glib
00254 {
00255 
00261 Gnome::Gda::Command wrap(GdaCommand* object, bool take_copy = false);
00262 
00263 } // namespace Glib
00264 
00265 
00266 #endif /* _LIBGDAMM_COMMAND_H */
00267 

Generated on Sat Feb 10 20:06:25 2007 for libgdamm by  doxygen 1.4.7