After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 536721 - Added Glib::Date GDate constructor.
Added Glib::Date GDate constructor.
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-06-05 01:37 UTC by José Alburquerque
Modified: 2008-07-11 16:04 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Glib::Date GDate constructor patch (10.64 KB, patch)
2008-06-05 01:39 UTC, José Alburquerque
none Details | Review
Replacement patch to add test (and make gobject_ private) (12.75 KB, patch)
2008-06-10 03:20 UTC, José Alburquerque
none Details | Review
Patch to make GDate constructor visible (adds copy constructor and assignment operator) (5.78 KB, patch)
2008-06-10 17:06 UTC, José Alburquerque
none Details | Review

Description José Alburquerque 2008-06-05 01:37:53 UTC
While working on some functions in gstreamermm that deal with Glib::Date, I noticed the need for a Glib::Date GDate constructor (it is actually a TODO). I noticed that it was in the source file, but I made it visible and modified it to use a GDate pointer and not a GDate reference. I also added a copy constructor and an assignment operator and modified the gobject_ variable to be a GDate pointer instead of a GDate reference (adding a destructor to free the gobject_). This makes the GDate constructor more logical by freeing the GDate* when the Glib::Date is destroyed.

I'm not sure if there are any binary compatibility issues, but I think these changes will make Glib::Date more usable. Is the included patch ok?
Comment 1 José Alburquerque 2008-06-05 01:39:09 UTC
Created attachment 112181 [details] [review]
Glib::Date GDate constructor patch
Comment 2 José Alburquerque 2008-06-10 03:20:23 UTC
Created attachment 112455 [details] [review]
Replacement patch to add test (and make gobject_ private)

I modified the patch because I had the member variable "gobject_" protected and not private.  This is what I really wasn't sure about because I'm not sure if variable should remain protected and destructor virtual so class could be extended or if variable should simply be private. For now I made variable private and added a test.
Comment 3 Murray Cumming 2008-06-10 06:51:54 UTC
+private:
+  GDate *gobject_;

-private:
-  GDate gobject_;

This would break ABI by changing the size of the whole class instance. Can't the contents of the GDate be copied?
Comment 4 José Alburquerque 2008-06-10 15:48:20 UTC
(In reply to comment #3)
> +private:
> +  GDate *gobject_;
> 
> -private:
> -  GDate gobject_;
> 
> This would break ABI by changing the size of the whole class instance. Can't
> the contents of the GDate be copied?
> 

In a way, I kind of thought it would but wasn't entirely sure. Would it also be broken if the signature of the GDate constructor be changed from `Date(const GDate&)' to `Date(const GDate*)'?
Comment 5 Murray Cumming 2008-06-10 15:52:03 UTC
> Would it also be broken if the signature of the GDate constructor be changed 
> from `Date(const GDate&)' to `Date(const GDate*)'?

But you said that neither of those constructors exists yet, so that wouldn't be a break.


Comment 6 José Alburquerque 2008-06-10 15:55:38 UTC
(In reply to comment #5)
> > Would it also be broken if the signature of the GDate constructor be changed 
> > from `Date(const GDate&)' to `Date(const GDate*)'?
> 
> But you said that neither of those constructors exists yet, so that wouldn't be
> a break.
> 

Did I? Sorry. `Date(const GDate&)' does exist; it's hidden by a `#ifndef DOXYGEN_SHOULD_SKIP_THIS' block at the moment.
Comment 7 José Alburquerque 2008-06-10 17:06:16 UTC
Created attachment 112491 [details] [review]
Patch to make GDate constructor visible (adds copy constructor and assignment operator)

This patch does not modify the signatures, access rights or types of members or methods. It makes the GDate constructor visible and adds a copy and assignment constructor.  It also adds a simple test.
Comment 8 José Alburquerque 2008-06-10 17:19:37 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > > Would it also be broken if the signature of the GDate constructor be changed 
> > > from `Date(const GDate&)' to `Date(const GDate*)'?
> > 
> > But you said that neither of those constructors exists yet, so that wouldn't be
> > a break.
> > 
> 
> Did I? Sorry. `Date(const GDate&)' does exist; it's hidden by a `#ifndef
> DOXYGEN_SHOULD_SKIP_THIS' block at the moment.
> 

It was the bug report subject that implied that there was no GDate constructor.  Once more, sorry about that.
Comment 9 Murray Cumming 2008-06-10 20:21:15 UTC
That looks good. Please commit.