00001
00002
00003 #ifndef _LIBGDAMM_DICTFIELD_H
00004 #define _LIBGDAMM_DICTFIELD_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 <libgdamm/object.h>
00032 #include <libgdamm/xmlstorage.h>
00033 #include <libgdamm/value.h>
00034 #include <libgdamm/dicttype.h>
00035
00036
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 typedef struct _GdaDictField GdaDictField;
00039 typedef struct _GdaDictFieldClass GdaDictFieldClass;
00040 #endif
00041
00042
00043 namespace Gnome
00044 {
00045
00046 namespace Gda
00047 { class DictField_Class; }
00048
00049 }
00050 namespace Gnome
00051 {
00052
00053 namespace Gda
00054 {
00055
00069 enum DictFieldAttribute
00070 {
00071 AUTO_INCREMENT = 1 << 0
00072 };
00073
00075 inline DictFieldAttribute operator|(DictFieldAttribute lhs, DictFieldAttribute rhs)
00076 { return static_cast<DictFieldAttribute>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
00077
00079 inline DictFieldAttribute operator&(DictFieldAttribute lhs, DictFieldAttribute rhs)
00080 { return static_cast<DictFieldAttribute>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
00081
00083 inline DictFieldAttribute operator^(DictFieldAttribute lhs, DictFieldAttribute rhs)
00084 { return static_cast<DictFieldAttribute>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
00085
00087 inline DictFieldAttribute operator~(DictFieldAttribute flags)
00088 { return static_cast<DictFieldAttribute>(~static_cast<unsigned>(flags)); }
00089
00091 inline DictFieldAttribute& operator|=(DictFieldAttribute& lhs, DictFieldAttribute rhs)
00092 { return (lhs = static_cast<DictFieldAttribute>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
00093
00095 inline DictFieldAttribute& operator&=(DictFieldAttribute& lhs, DictFieldAttribute rhs)
00096 { return (lhs = static_cast<DictFieldAttribute>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
00097
00099 inline DictFieldAttribute& operator^=(DictFieldAttribute& lhs, DictFieldAttribute rhs)
00100 { return (lhs = static_cast<DictFieldAttribute>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
00101
00102 }
00103
00104 }
00105
00106
00107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00108 namespace Glib
00109 {
00110
00111 template <>
00112 class Value<Gnome::Gda::DictFieldAttribute> : public Glib::Value_Flags<Gnome::Gda::DictFieldAttribute>
00113 {
00114 public:
00115 static GType value_type() G_GNUC_CONST;
00116 };
00117
00118 }
00119 #endif
00120
00121
00122 namespace Gnome
00123 {
00124
00125 namespace Gda
00126 {
00127
00128
00129 class Connection;
00130
00139 class DictField
00140 : public Gda::Object,
00141 public XmlStorage
00142 {
00143
00144 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00145
00146 public:
00147 typedef DictField CppObjectType;
00148 typedef DictField_Class CppClassType;
00149 typedef GdaDictField BaseObjectType;
00150 typedef GdaDictFieldClass BaseClassType;
00151
00152 private: friend class DictField_Class;
00153 static CppClassType dictfield_class_;
00154
00155 private:
00156
00157 DictField(const DictField&);
00158 DictField& operator=(const DictField&);
00159
00160 protected:
00161 explicit DictField(const Glib::ConstructParams& construct_params);
00162 explicit DictField(GdaDictField* castitem);
00163
00164 #endif
00165
00166 public:
00167 virtual ~DictField();
00168
00169 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00170 static GType get_type() G_GNUC_CONST;
00171 static GType get_base_type() G_GNUC_CONST;
00172 #endif
00173
00175 GdaDictField* gobj() { return reinterpret_cast<GdaDictField*>(gobject_); }
00176
00178 const GdaDictField* gobj() const { return reinterpret_cast<GdaDictField*>(gobject_); }
00179
00181 GdaDictField* gobj_copy();
00182
00183 private:
00184
00185
00186 protected:
00187
00188 explicit DictField(const Glib::RefPtr<Dict>& dict, const Glib::RefPtr<DictType>& type);
00189
00190 public:
00191
00192 static Glib::RefPtr<DictField> create(const Glib::RefPtr<Dict>& dict, const Glib::RefPtr<DictType>& type);
00193
00194
00195 void set_length(int length);
00196
00200 int get_length() const;
00201
00202 void set_scale(int length);
00203
00207 int get_scale() const;
00208
00209
00210
00215 GSList* get_constraints();
00216
00217
00221 void set_dict_type(const Glib::RefPtr<DictType>& type);
00222
00223
00229 void set_default_value(const Value& value);
00230
00231
00232
00235 bool is_null_allowed() const;
00236
00239 bool is_pkey_part() const;
00240
00243 bool is_pkey_alone() const;
00244
00247 bool is_fkey_part() const;
00248
00253 bool is_fkey_alone() const;
00254
00255
00256 void set_attributes(DictFieldAttribute attributes);
00257
00258 DictFieldAttribute get_attributes() const;
00259
00260
00261
00262
00263 public:
00264
00265 public:
00266
00267 #ifdef GLIBMM_VFUNCS_ENABLED
00268 #endif //GLIBMM_VFUNCS_ENABLED
00269
00270 protected:
00271
00272 #ifdef GLIBMM_VFUNCS_ENABLED
00273 #endif //GLIBMM_VFUNCS_ENABLED
00274
00275
00276 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00277 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
00278
00279
00280 };
00281
00282 }
00283 }
00284
00285
00286 namespace Glib
00287 {
00293 Glib::RefPtr<Gnome::Gda::DictField> wrap(GdaDictField* object, bool take_copy = false);
00294 }
00295
00296
00297 #endif
00298