gnomemm r1394 - in gstreamermm/trunk: . gstreamer/src tests
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1394 - in gstreamermm/trunk: . gstreamer/src tests
- Date: Fri, 7 Mar 2008 02:53:32 +0000 (GMT)
Author: jaalburqu
Date: Fri Mar 7 02:53:31 2008
New Revision: 1394
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1394&view=rev
Log:
2008-03-06 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/src/structure.ccg:
* gstreamer/src/structure.hg: Modified set_field() and remove_field()
to return the Structure (thus allowing "chain" setting and removing);
Added docs; Reordered methods to C API order. Must find a way of
adding gtypes GST_TYPE_FRACTION, GST_TYPE_DATE along with other
gstreamer specific gtypes like G_TYPE_INT_RANGE to Structure correctly
(see GstValue C API docs and GStreamer Application Development Manual
sections 8.2.2 and 8.2.3)
* tests/test-structure.cc: Modified test to use "chain setting"
* gstreamer/src/element.hg: Removed virtual from ElementInterfaced
destructor def since its base class (Element) destructor is virtual
which makes derived destructor virtual already
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/src/element.hg
gstreamermm/trunk/gstreamer/src/structure.ccg
gstreamermm/trunk/gstreamer/src/structure.hg
gstreamermm/trunk/tests/test-structure.cc
Modified: gstreamermm/trunk/gstreamer/src/element.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/element.hg (original)
+++ gstreamermm/trunk/gstreamer/src/element.hg Fri Mar 7 02:53:31 2008
@@ -178,7 +178,7 @@
public T_Interface
{
public:
- virtual ~ElementInterfaced();
+ ~ElementInterfaced();
protected:
ElementInterfaced(const ElementInterfaced&);
Modified: gstreamermm/trunk/gstreamer/src/structure.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/structure.ccg (original)
+++ gstreamermm/trunk/gstreamer/src/structure.ccg Fri Mar 7 02:53:31 2008
@@ -58,6 +58,18 @@
value.init(gst_structure_get_value(gobj(), name.c_str()));
}
+Structure&
+Structure::set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value)
+{
+ gst_structure_set_value(gobj(), fieldname.c_str(), value.gobj());
+}
+
+Structure&
+Structure::remove_field(const Glib::ustring& fieldname)
+{
+ gst_structure_remove_field(gobj(), fieldname.c_str());
+}
+
bool
Structure::get_boolean(const Glib::ustring& name, Glib::ValueBase& value) const
{
Modified: gstreamermm/trunk/gstreamer/src/structure.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/structure.hg (original)
+++ gstreamermm/trunk/gstreamer/src/structure.hg Fri Mar 7 02:53:31 2008
@@ -60,53 +60,172 @@
public:
Structure(const Glib::ustring& name);
- _WRAP_METHOD(int get_size() const, gst_structure_n_fields)
- _WRAP_METHOD(void remove_all_fields(), gst_structure_remove_all_fields)
-
- _WRAP_METHOD(void set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value), gst_structure_set_value)
+ _WRAP_METHOD(Glib::ustring get_name() const, gst_structure_get_name)
+ _WRAP_METHOD(bool has_name(const Glib::ustring& name) const, gst_structure_has_name)
+ _WRAP_METHOD(void set_name(const Glib::ustring& name), gst_structure_set_name)
+ _WRAP_METHOD(Glib::QueryQuark get_name_id() const, gst_structure_get_name_id)
+ /** Get the value of the field with name fieldname.
+ *
+ * @param fieldname the name of the field to get
+ * @param value the Value class in which to store the value
+ */
void get_field(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
- _WRAP_METHOD(void remove_field(const Glib::ustring& fieldname), gst_structure_remove_field)
+ /** Sets the field with the given name field to value. If the field does not
+ * exist, it is created. If the field exists, the previous value is replaced
+ * and freed. Returns this Structure for continued setting convenience.
+ *
+ * @param fieldname the name of the field to set
+ * @param value the new value of the field
+ * @return this Structure
+ */
+ Structure& set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
+
+ /** Removes the field with the given name. If the field with the given name
+ * does not exist, the structure is unchanged. Returns this Structure for
+ * continued setting convenience.
+ *
+ * @param fieldname the name of the field to remove
+ * @return this Structure
+ */
+ Structure& remove_field(const Glib::ustring& fieldname);
+
+ _WRAP_METHOD(void remove_all_fields(), gst_structure_remove_all_fields)
_WRAP_METHOD(GType get_field_type(const Glib::ustring& fieldname) const, gst_structure_get_field_type)
bool foreach(const SlotForeach& slot);
+ _WRAP_METHOD(int get_size() const, gst_structure_n_fields)
_WRAP_METHOD(bool has_field(const Glib::ustring& fieldname) const, gst_structure_has_field)
_WRAP_METHOD(bool has_field(const Glib::ustring& fieldname, GType type) const, gst_structure_has_field_typed)
- /**
+ /** Sets the GValue of value to the boolean value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a boolean, this
+ * function returns FALSE.
*/
bool get_boolean(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the int value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain an int, this function
+ * returns FALSE returns FALSE
+ */
bool get_int(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the uint value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain an uint, this
+ * function returns FALSE returns FALSE
+ */
bool get_uint(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the fourc value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a fourc, this
+ * function returns FALSE returns FALSE
+ */
bool get_fourcc(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the double value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a double, this
+ * function returns FALSE returns FALSE
+ */
bool get_double(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the string value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a string, this
+ * function returns FALSE returns FALSE
+ */
bool get_string(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the GDate value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a GDate, this
+ * function returns FALSE returns FALSE
+ */
bool get_date(const Glib::ustring& fieldname, Glib::Date& value) const;
+ /** Sets the GValue of value to the ClockTime value of the given field.
+ * Caller is responsible for making sure the field exists and has the correct
+ * type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a ClockTime, this
+ * function returns FALSE returns FALSE
+ */
bool get_clock_time(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the enum value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a enum, this
+ * function returns FALSE returns FALSE
+ */
bool get_enum(const Glib::ustring& fieldname, GType enumtype, Glib::ValueBase& value) const;
+ /** Sets the GValue of value to the Fraction value of the given field. Caller
+ * is responsible for making sure the field exists and has the correct type.
+ *
+ * @param fieldname the name of a field
+ * @param value the Value class to set
+ * @return TRUE if the value could be set correctly. If there was no field
+ * with fieldname or the existing field did not contain a Fraction, this
+ * function returns FALSE returns FALSE
+ */
bool get_fraction(const Glib::ustring& fieldname, int& value_numerator, int& value_denominator) const;
+ /** Calls the provided slot once for each field in the Structure. In contrast
+ * to foreach(), the function may modify but not delete the fields. The
+ * structure must be mutable.
+ *
+ * @param slot a slot to call for each field
+ * @return TRUE if the supplied slot returns TRUE For each of the fields,
+ * FALSE otherwise.
+ */
bool map_in_place(const SlotMap& slot);
+ _WRAP_METHOD(Glib::ustring nth_field_name(guint index) const, gst_structure_nth_field_name)
+ _WRAP_METHOD(Glib::ustring to_string() const, gst_structure_to_string)
+
static Structure create_from_string(const Glib::ustring& the_string);
- _WRAP_METHOD(Glib::QueryQuark get_name_id() const, gst_structure_get_name_id)
- _WRAP_METHOD(Glib::ustring get_name() const, gst_structure_get_name)
- _WRAP_METHOD(bool has_name(const Glib::ustring& name) const, gst_structure_has_name)
- _WRAP_METHOD(void set_name(const Glib::ustring& name), gst_structure_set_name)
- _WRAP_METHOD(Glib::ustring to_string() const, gst_structure_to_string)
- _WRAP_METHOD(Glib::ustring nth_field_name(guint index) const, gst_structure_nth_field_name)
_IGNORE(
gst_structure_get_date,
gst_structure_id_set,
Modified: gstreamermm/trunk/tests/test-structure.cc
==============================================================================
--- gstreamermm/trunk/tests/test-structure.cc (original)
+++ gstreamermm/trunk/tests/test-structure.cc Fri Mar 7 02:53:31 2008
@@ -33,7 +33,11 @@
stringValue.init(Glib::Value<Glib::ustring>::value_type());
stringValue.set("Hello; This is a ustring.");
- structure.set_field(Glib::Quark("string"), stringValue);
+ Glib::Value<int> intValue;
+ intValue.init(Glib::Value<int>::value_type());
+ intValue.set(100);
+
+ structure.set_field(Glib::Quark("string"), stringValue).set_field("integer", intValue);
Glib::Value<Glib::ustring> value;
structure.get_field("string", value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]