37 #ifndef H_OGF_GOM_TYPES_OBJECT_H
38 #define H_OGF_GOM_TYPES_OBJECT_H
58 class ConnectionTable;
64 gom_attribute(
abstract,
"true")
73 explicit Object(
bool transient =
false);
107 unsigned int id()
const {
140 const std::string& method_name,
154 const std::string& method_name,
const ArgList& args
157 return invoke_method(method_name, args, ret_val);
171 return invoke_method(method_name, args, ret_val);
190 const std::string& prop_name, std::string& prop_value
203 const std::string& signal_name,
204 Object* to,
const std::string& slot_name
227 if(id_to_object_ ==
nullptr) {
230 auto it = id_to_object_->find(
id);
231 if(it == id_to_object_->end()) {
262 const std::string& needle,
const std::string& path=
""
272 virtual index_t get_nb_elements()
const;
280 return signals_enabled_;
289 signals_enabled_ = value;
298 return slots_enabled_;
307 slots_enabled_ = value;
347 bool equals(
const Object* other)
const;
381 signals_enabled_ =
true;
388 signals_enabled_ =
false;
395 slots_enabled_ =
true;
402 slots_enabled_ =
false;
419 const std::string& name,
const std::string& value
441 const std::string& name,
const Any& value
452 const std::string& prop_name,
Any& prop_value
470 const std::string& signal_name,
const ArgList& args,
471 bool called_from_slot =
false
476 ConnectionTable* connections_;
477 bool signals_enabled_;
484 static std::map<index_t, Object*>* id_to_object_;
Generic arguments and argument lists.
Base class for reference-counted objects.
A class that stores a variable of arbitrary type.
Represents a list of name-value pairs.
Base class for all objects in the GOM system.
bool has_method(const std::string &method_name) const
Tests whether a method is defined.
virtual ~Object()
Object destructor.
virtual void set_element(index_t i, const Any &value)
Sets an element by index.
static Object * id_to_object(unsigned int id)
Gets an object from a unique object id.
virtual bool set_property(const std::string &name, const Any &value)
Sets an individual property.
virtual std::string get_doc() const
Gets the documentation.
virtual bool is_a(const MetaType *type) const
Tests whether this object inherits a given type.
virtual MetaClass * meta_class() const
Gets the meta class.
MetaClass * get_meta_class() const
Gets the meta class.
virtual bool set_property(const std::string &name, const std::string &value)
Sets an individual property.
bool get_signals_enabled() const
Tests wheter signals are enabled.
void help() const
Displays some help about this object.
void enable_slots()
Enables slots.
void disconnect()
Removes all connections from signals of this objects.
void set_signals_enabled(bool value)
Enables or disables signals.
virtual bool emit_signal(const std::string &signal_name, const ArgList &args, bool called_from_slot=false)
Emits a signal and calls the slots it is connected to.
void set_properties(const ArgList &args)
Sets several properties in a single call.
std::string get_string_id() const
Gets the unique string identifier.
void enable_signals()
Enables signals.
void set_slots_enabled(bool value)
Enables or disables slots.
Object(bool transient=false)
Object constructor.
virtual void add_connection(Connection *connection)
Adds a connection to this object.
virtual void set_meta_class(MetaClass *mclass)
Sets the meta class.
std::string string_id() const
Gets the unique string identifier.
virtual void remove_connection(Connection *connection)
Removes a connection to this object.
virtual void get_element(index_t i, Any &value) const
Gets an element by index.
virtual void search(const std::string &needle, const std::string &path="")
Displays the names of all objects that contain a substring.
void disable_slots()
Disables slots.
void disable_signals()
Disables signals.
bool get_slots_enabled() const
Tests wheter slots are enabled.
virtual Sign compare(const Object *other) const
Compares this object with another one.
bool invoke_method(const std::string &method_name)
Invokes a method by method name.
bool has_property(const std::string &prop_name) const
Tests whether a property is defined.
virtual bool get_property(const std::string &prop_name, std::string &prop_value) const
Gets a property.
virtual bool get_property(const std::string &prop_name, Any &prop_value) const
Gets a property.
unsigned int id() const
Gets the identifier of this object.
virtual bool invoke_method(const std::string &method_name, const ArgList &args, Any &ret_val)
Invokes a method by method name and argument list, and gets the return value.
bool invoke_method(const std::string &method_name, const ArgList &args)
Invokes a method by method name and argument list.
virtual Connection * connect_signal_to_slot(const std::string &signal_name, Object *to, const std::string &slot_name)
Connects a signal with a slot of another object.
geo_index_t index_t
The type for storing and manipulating indices.
Sign
Integer constants that represent the sign of a value.
Global Graphite namespace.
SmartPointer< Object > Object_var
An automatic reference-counted pointer to an Object.
Definitions common to all include files in the gom library.