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

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 #include <glibmm.h>
00007 
00008 /* $Id: command.hg,v 1.5 2004/04/29 23:07:13 murrayc Exp $ */
00009 // -*- C++ -*- // this is for the .hg, I realize gensig puts one in
00010 
00011 /* command.h
00012  *
00013  * Copyright 2003 libgdamm Development Team
00014  *
00015  * This library is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU Library General Public
00017  * License as published by the Free Software Foundation; either
00018  * version 2 of the License, or (at your option) any later version.
00019  *
00020  * This library is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023  * Library General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU Library General Public
00026  * License along with this library; if not, write to the Free
00027  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00028  */
00029 
00030 #include <libgdamm/transaction.h>
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 
00158 class Command
00159 {
00160   public:
00161 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00162   typedef Command CppObjectType;
00163   typedef GdaCommand BaseObjectType;
00164 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
00165 
00166   Command();
00167 
00168   // Use make_a_copy=true when getting it directly from a struct.
00169   explicit Command(GdaCommand* castitem, bool make_a_copy = false);
00170 
00171   Command(const Command& src);
00172   Command& operator=(const Command& src);
00173 
00174   ~Command();
00175 
00176   GdaCommand*       gobj()       { return gobject_; }
00177   const GdaCommand* gobj() const { return gobject_; }
00178 
00180   GdaCommand* gobj_copy() const;
00181 
00182 protected:
00183   GdaCommand* gobject_;
00184 
00185 private:
00186 
00187   
00188 public:
00189   //TODO: What do the other command types do? How do they work?
00190   explicit Command(const Glib::ustring& text, CommandType type = COMMAND_TYPE_SQL, CommandOptions options = COMMAND_OPTION_STOP_ON_ERRORS); //TODO: Good defaults.
00191  
00192   
00193   Glib::ustring get_text() const;
00194   
00195   void set_text(const Glib::ustring& text);
00196   
00197   CommandType get_command_type() const;
00198   
00199   void set_command_type(CommandType type);
00200   
00201   CommandOptions get_options() const;
00202   
00203   void set_options(CommandOptions options);
00204   
00205   Glib::RefPtr<Transaction> get_transaction();
00206   
00207   Glib::RefPtr<const Transaction> get_transaction() const;
00208   
00209   void set_transaction(const Glib::RefPtr<Transaction>& xaction);
00210 
00211 
00212 };
00213 
00214 } // namespace Gda
00215 } // namespace Gnome
00216 
00217 
00218 namespace Glib
00219 {
00220 
00226 Gnome::Gda::Command wrap(GdaCommand* object, bool take_copy = false);
00227 
00228 } // namespace Glib
00229 
00230 #endif /* _LIBGDAMM_COMMAND_H */
00231 

Generated on Wed Mar 23 12:43:50 2005 for libgdamm by  doxygen 1.4.0