/usr/include/libgdamm-5.0/libgdamm/holder.h is in libgdamm5.0-dev 4.99.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | // -*- c++ -*-
// Generated by gmmproc 2.46.1 -- DO NOT MODIFY!
#ifndef _LIBGDAMM_HOLDER_H
#define _LIBGDAMM_HOLDER_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
// -*- C++ -*- //
/* set.h
*
* Copyright 2006 libgdamm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or(at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <libgdamm/datahandler.h>
#include <libgdamm/value.h>
#include <glibmm/object.h>
#include <glibmm/error.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdaHolder GdaHolder;
typedef struct _GdaHolderClass GdaHolderClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gnome
{
namespace Gda
{ class Holder_Class; } // namespace Gda
} // namespace Gnome
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gnome
{
namespace Gda
{
class DataModel;
class HolderError : public Glib::Error
{
public:
/**
*/
enum Code
{
HOLDER_STRING_CONVERSION_ERROR,
HOLDER_VALUE_TYPE_ERROR,
HOLDER_VALUE_NULL_ERROR
};
HolderError(Code error_code, const Glib::ustring& error_message);
explicit HolderError(GError* gobject);
Code code() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
static void throw_func(GError* gobject);
friend void wrap_init(); // uses throw_func()
#endif //DOXYGEN_SHOULD_SKIP_THIS
};
} // namespace Gda
} // namespace Gnome
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<Gnome::Gda::HolderError::Code> : public Glib::Value_Enum<Gnome::Gda::HolderError::Code>
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gnome
{
namespace Gda
{
/** Container for a single Gda::Value.
*
* The GdaHolder is a container for a single Gda::Value value. It also specifies
* various attributes of the contained value (default value, ...)
*
* @ingroup DataHandlers
*/
class Holder : public Glib::Object
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef Holder CppObjectType;
typedef Holder_Class CppClassType;
typedef GdaHolder BaseObjectType;
typedef GdaHolderClass BaseClassType;
// noncopyable
Holder(const Holder&) = delete;
Holder& operator=(const Holder&) = delete;
private: friend class Holder_Class;
static CppClassType holder_class_;
protected:
explicit Holder(const Glib::ConstructParams& construct_params);
explicit Holder(GdaHolder* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
Holder(Holder&& src) noexcept;
Holder& operator=(Holder&& src) noexcept;
virtual ~Holder() noexcept;
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
GdaHolder* gobj() { return reinterpret_cast<GdaHolder*>(gobject_); }
///Provides access to the underlying C GObject.
const GdaHolder* gobj() const { return reinterpret_cast<GdaHolder*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GdaHolder* gobj_copy();
private:
protected:
Holder(GType g_type, const Glib::ustring& id);
public:
static Glib::RefPtr<Holder> create(GType g_type, const Glib::ustring& id);
/** Copy constructor.
*
* @note if @a orig is set with a static value (see take_static_value())
* its copy will have a fresh new allocated GValue, so that user should free it when done.
*
* @return A new Gda::Holder object.
*/
Glib::RefPtr<Holder> copy() const;
/** Get @a holder's type
*
* @return The data type.
*/
GType get_g_type() const;
/** Get the ID of @a holder. The ID can be set using @a holder's "id" property
*
* @return The ID (don't modify the string).
*/
Glib::ustring get_id() const;
/** Get the value held into the holder. If @a holder is set to use its default value
* and that default value is not of the same type as @a holder, then <tt>0</tt> is returned.
*
* If @a holder is set to <tt>0</tt>, then the returned value is a Gda::TYPE_NULL GValue.
*
* @return The value, or <tt>0</tt>.
*/
Value get_value() const;
/** Same functionality as get_value() except that it returns the value as a string
* (the conversion is done using @a dh if not <tt>0</tt>, or the default data handler otherwise).
*
* @param dh A Gda::DataHandler to use, or <tt>0</tt>.
* @return The value, or <tt>0</tt>.
*/
Glib::ustring get_value_str(const Glib::RefPtr<DataHandler>& dh) const;
/** Sets the value within the holder. If @a holder is an alias for another
* holder, then the value is also set for that other holder.
*
* On success, the action of any call to force_invalid() is cancelled
* as soon as this method is called (even if @a holder's value does not actually change)
*
* If the value is not different from the one already contained within @a holder,
* then @a holder is not changed and no signal is emitted.
*
* @note the @a value argument is treated the same way if it is <tt>0</tt> or if it is a Gda::TYPE_NULL value
*
* @note if @a holder can't accept the @a value value, then this method returns <tt>false</tt>, and @a holder will be left
* in an invalid state.
*
* @note before the change is accepted by @a holder, the "validate-change" signal will be emitted (the value
* of which can prevent the change from happening) which can be connected to to have a greater control
* of which values @a holder can have, or implement some business rules.
*
* @param value A value to set the holder to, or <tt>0</tt>.
* @return <tt>true</tt> if value has been set.
*/
bool set_value_as_value(const Value& value);
//TODO: Documentation:
template <class ValueType>
bool set_value(const ValueType& value);
/** Same functionality as set_value() except that it uses a string representation
* of the value to set, which will be converted into a GValue first (using default data handler if
* @a dh is <tt>0</tt>).
*
* @note if @a value is <tt>0</tt> or is the "<tt>0</tt>" string, then @a holder's value is set to <tt>0</tt>.
* @note if @a holder can't accept the @a value value, then this method returns <tt>false</tt>, and @a holder will be left
* in an invalid state.
*
* @param dh A Gda::DataHandler to use, or <tt>0</tt>.
* @param value A value to set the holder to, as a string.
* @return <tt>true</tt> if value has been set.
*/
bool set_value_str(const Glib::RefPtr<DataHandler>& dh, const Glib::ustring& value);
/** Sets the value within the holder. If @a holder is an alias for another
* holder, then the value is also set for that other holder.
*
* On success, the action of any call to force_invalid() is cancelled
* as soon as this method is called (even if @a holder's value does not actually change).
*
* If the value is not different from the one already contained within @a holder,
* then @a holder is not changed and no signal is emitted.
*
* @note if @a holder can't accept the @a value value, then this method returns <tt>false</tt>, and @a holder will be left
* in an invalid state.
*
* @note before the change is accepted by @a holder, the "validate-change" signal will be emitted (the value
* of which can prevent the change from happening) which can be connected to to have a greater control
* of which values @a holder can have, or implement some business rules.
*
* @note if user previously set this holder with take_static_value() the GValue
* stored internally will be forgiven and replaced by the @a value. User should then
* take care of the 'old' static GValue.
*
* @param value A value to set the holder to.
* @return <tt>true</tt> if value has been set.
*/
bool take_value(const Value& value);
/** Sets the const value within the holder. If @a holder is an alias for another
* holder, then the value is also set for that other holder.
*
* The value will not be freed, and user should take care of it, either for its
* freeing or for its correct value at the moment of query.
*
* If the value is not different from the one already contained within @a holder,
* then @a holder is not changed and no signal is emitted.
*
* @note if @a holder can't accept the @a value value, then this method returns <tt>0</tt>, and @a holder will be left
* in an invalid state.
*
* @note before the change is accepted by @a holder, the "validate-change" signal will be emitted (the value
* of which can prevent the change from happening) which can be connected to to have a greater control
* of which values @a holder can have, or implement some business rules.
*
* @param value A const value to set the holder to.
* @param value_changed A boolean set with <tt>true</tt> if the value changes, <tt>false</tt> elsewhere.
* @return <tt>0</tt> if an error occurred or if the previous GValue was <tt>0</tt> itself. It returns
* the static GValue user set previously, so that he can free it.
*/
Value take_static_value(const Value& value, bool& value_changed);
void set_attribute(const Glib::ustring& attribute, const Value& value);
//TODO: gda_holder_set_attribute() has stupid memory management: _WRAP_METHOD(void set_attribute(const Glib::ustring& attribute, const Value& value), gda_holder_set_attribute)
/** Get the value associated to a named attribute.
*
* Attributes can have any name, but Libgda proposes some default names, see this section.
*
* @param attribute Attribute name as a string.
* @return A read-only Value, or <tt>0</tt> if not attribute named @a attribute has been set for @a holder.
*/
Value get_attribute(const Glib::ustring& attribute) const;
/** Get the default value held into the holder. WARNING: the default value does not need to be of
* the same type as the one required by @a holder.
*
* @return The default value.
*/
Value get_default_value() const;
/** Sets the default value within the holder. If @a value is <tt>0</tt> then @a holder won't have a
* default value anymore. To set a default value to <tt>0</tt>, then pass a Value created using
* gda_value_new_null().
*
* NOTE: the default value does not need to be of the same type as the one required by @a holder.
*
* @param value A value to set the holder's default value, or <tt>0</tt>.
*/
void set_default_value(const Value& value);
/** Set @a holder's value to its default value.
*
* @return <tt>true</tt> if @a holder has got a default value.
*/
bool set_value_to_default();
/** Tells if @a holder's current value is the default one.
*
* @return <tt>true</tt> if @a holder @a holder's current value is the default one.
*/
bool value_is_default() const;
/** Forces a holder to be invalid; to set it valid again, a new value must be assigned
* to it using set_value() or take_value().
*
* @a holder's value is set to <tt>0</tt>.
*/
void force_invalid();
//TODO: gda_holder_force_invalid_e() is a way to _set_ an error, not throw an error.
//The error is later returned by gda_holder_is_valid_e(). We can probably ignore it.
/** Get the validity of @a holder (that is, of the value held by @a holder)
*
* @return <tt>true</tt> if @a holder's value can safely be used.
*/
bool is_valid() const;
//Ignore gda_holder_is_valid_e() because throwing an exception would be odd for an is_*() method.
/** Sets if the holder can have a <tt>0</tt> value. If @a not_null is <tt>true</tt>, then that won't be allowed
*
* @param not_null <tt>true</tt> if @a holder should not accept <tt>0</tt> values.
*/
void set_not_null(bool not_null = true);
/** Get wether the holder can be <tt>0</tt> or not
*
* @return <tt>true</tt> if the holder cannot be <tt>0</tt>.
*/
bool get_not_null() const;
/** If set_source_model() has been used to provide a hint that @a holder's value
* should be among the values contained in a column of a data model, then this method
* returns which data model, and if @a col is not <tt>0</tt>, then it is set to the restricting column
* as well.
*
* Otherwise, this method returns <tt>0</tt>, and if @a col is not <tt>0</tt>, then it is set to 0.
*
* @param col A place to store the column in the model sourcing the holder, or <tt>0</tt>.
* @return A pointer to a Gda::DataModel, or <tt>0</tt>.
*/
Glib::RefPtr<DataModel> get_source_model(int& col);
/** If set_source_model() has been used to provide a hint that @a holder's value
* should be among the values contained in a column of a data model, then this method
* returns which data model, and if @a col is not <tt>0</tt>, then it is set to the restricting column
* as well.
*
* Otherwise, this method returns <tt>0</tt>, and if @a col is not <tt>0</tt>, then it is set to 0.
*
* @param col A place to store the column in the model sourcing the holder, or <tt>0</tt>.
* @return A pointer to a Gda::DataModel, or <tt>0</tt>.
*/
Glib::RefPtr<const DataModel> get_source_model(int& col) const;
/** Sets an hint that @a holder's values should be restricted among the values
* contained in the @a col column of the @a model data model. Note that this is just a hint,
* meaning this policy is not enforced by @a holder's implementation.
*
* @param model A Gda::DataModel object or <tt>0</tt>.
* @param col The reference column in @a model.
* @return <tt>true</tt> if no error occurred.
*/
bool set_source_model(const Glib::RefPtr<DataModel>& model, int col);
/** Sets @a holder to change when @a bind_to changes (and does not make @a bind_to change when @a holder changes).
* For the operation to succeed, the GType of @a holder and @a bind_to must be the same, with the exception that
* any of them can have a Gda::TYPE_NULL type (in this situation, the GType of the two Gda::Holder objects
* involved is set to match the other when any of them sets its type to something different than GDA_TYPE_NULL).
*
* If @a bind_to is <tt>0</tt>, then @a holder will not be bound anymore.
*
* @param bind_to A Gda::Holder or <tt>0</tt>.
* @return <tt>true</tt> if no error occurred.
*/
void set_bind(const Glib::RefPtr<Holder>& bind_to);
/** Get the holder which makes @a holder change its value when the holder's value is changed.
*
* @return The Gda::Holder or <tt>0</tt>.
*/
Glib::RefPtr<Holder> get_bind();
/** Get the holder which makes @a holder change its value when the holder's value is changed.
*
* @return The Gda::Holder or <tt>0</tt>.
*/
Glib::RefPtr<const Holder> get_bind() const;
/** Holder's description.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::ustring > property_description() ;
/** Holder's description.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_description() const;
/** Make value holder follow other GdaHolder's changes and the other way around.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::RefPtr<Holder> > property_full_bind() ;
/** Make value holder follow other GdaHolder's changes and the other way around.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Holder> > property_full_bind() const;
/** Holder's GType.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< gulong > property_g_type() ;
/** Holder's GType.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< gulong > property_g_type() const;
/** Holder's ID.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::ustring > property_id() ;
/** Holder's ID.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_id() const;
/** Holder's name.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::ustring > property_name() ;
/** Holder's name.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_name() const;
/** Can the value holder be NULL?.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< bool > property_not_null() ;
/** Can the value holder be NULL?.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_not_null() const;
/** Make value holder follow other GdaHolder's changes.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::RefPtr<Holder> > property_simple_bind() ;
/** Make value holder follow other GdaHolder's changes.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Holder> > property_simple_bind() const;
/** Column number to use in coordination with the source-model property.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< int > property_source_column() ;
/** Column number to use in coordination with the source-model property.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< int > property_source_column() const;
/** Data model among which the holder's value should be.
*
* @return A PropertyProxy that allows you to get or set the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy< Glib::RefPtr<DataModel> > property_source_model() ;
/** Data model among which the holder's value should be.
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DataModel> > property_source_model() const;
/**
* @par Slot Prototype:
* <tt>void on_my_%changed()</tt>
*
*/
Glib::SignalProxy0< void > signal_changed();
/**
* @par Slot Prototype:
* <tt>void on_my_%source_changed()</tt>
*
*/
Glib::SignalProxy0< void > signal_source_changed();
/**
* @par Slot Prototype:
* <tt>Glib::Error on_my_%validate_change(const Value& value)</tt>
*
*/
Glib::SignalProxy1< Glib::Error,const Value& > signal_validate_change();
/**
* @par Slot Prototype:
* <tt>void on_my_%attribute_changed(const Glib::ustring& attr_name, const Value& value)</tt>
*
*/
Glib::SignalProxy2< void,const Glib::ustring&,const Value& > signal_attribute_changed();
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
/// This is a default handler for the signal signal_changed().
virtual void on_changed();
/// This is a default handler for the signal signal_source_changed().
virtual void on_source_changed();
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <class ValueType> inline
bool Holder::set_value(const ValueType& value)
{
Gnome::Gda::Value gdavalue(value);
return this->set_value_as_value(gdavalue);
}
#endif //DOXYGEN_SHOULD_SKIP_THIS
} // namespace Gda
} // namespace Gnome
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gnome::Gda::Holder
*/
Glib::RefPtr<Gnome::Gda::Holder> wrap(GdaHolder* object, bool take_copy = false);
}
#endif /* _LIBGDAMM_HOLDER_H */
|