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 517787 - Add operator<< and operator>> to Gio streams
Add operator<< and operator>> to Gio streams
Status: RESOLVED OBSOLETE
Product: glibmm
Classification: Bindings
Component: io
2.15.x
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2008-02-21 02:10 UTC by Jonathon Jongsma
Modified: 2018-05-22 12:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Here's a start at implementing operator<< for Gio::OutputStream (4.01 KB, patch)
2008-02-21 02:13 UTC, Jonathon Jongsma
none Details | Review

Description Jonathon Jongsma 2008-02-21 02:10:21 UTC
It'd be nice to add some basic support for the insertion and extraction operators in giomm.
Comment 1 Jonathon Jongsma 2008-02-21 02:13:23 UTC
Created attachment 105677 [details] [review]
Here's a start at implementing operator<< for Gio::OutputStream

A starting point for discussion, not necessarily a finalized proposal.  One thing to note is that I added another 'test' to the tests/giomm_simple/ directory instead of adding a new test subdir.  That meant that i needed to rename the existing main.cc file to something more descriptive, which is why it looks like there's so much change in the tests directory
Comment 2 Marko Anastasov 2008-02-22 10:33:17 UTC
These new functions (operator<<, endl) should probably be virtual.

What about an overload that takes a sigc::slot?

g*mm indentation should be 2 spaces...

Also I have just seen that we do not have an InputStream::read() overload for strings.
Comment 3 Jonathon Jongsma 2008-02-22 14:23:41 UTC
(In reply to comment #2)
> These new functions (operator<<, endl) should probably be virtual.

Well, these are currently not even member functions, are you suggesting that they should be member functions?

> What about an overload that takes a sigc::slot?

Do you mean that the manipulator should be a sigc::slot instead of a function pointer typedef?

> g*mm indentation should be 2 spaces...

true

> Also I have just seen that we do not have an InputStream::read() overload for
> strings.

Is that different than this mailing list post? http://mail.gnome.org/archives/gtkmm-list/2008-February/msg00119.html
Comment 4 Marko Anastasov 2008-02-22 15:55:04 UTC
Well. Now I realize. I apogolize for these... inconsistencies. I am clearly of no help when replying from uni without the necessary concetration, so you can sort of scratch my whole reply above.

> (In reply to comment #2)
> > These new functions (operator<<, endl) should probably be virtual.
> 
> Well, these are currently not even member functions, are you suggesting that
> they should be member functions?

(I do think that it's better to keep them as non-members, to keep the interface clean.)

> > What about an overload that takes a sigc::slot?
> 
> Do you mean that the manipulator should be a sigc::slot instead of a function
> pointer typedef?

Yes, it occurred to me since you provided the one with function pointer.

> > Also I have just seen that we do not have an InputStream::read() overload for
> > strings.
> 
> Is that different than this mailing list post?
> http://mail.gnome.org/archives/gtkmm-list/2008-February/msg00119.html

Nope, apologies as above.

Still I do stand by my reply in the mailing list thread. It is not so easy to see what would be an optimal tradeoff between providing C++-specific helpers and keeping the binding "clean". Regarding read(), I'm not really worried about convenience vs hidden performance cost. It's up to the API user to decide which call would be more appropriate. It's just about how far we want to go with these helpers.

operator>>(string&) would need to read until EOL, which would then depend on this read() overload, or maybe another one for the purpose of reading until EOL.

I think that for, both operators, it would be nice to have overloads for different datatypes. But then you've actually begun implementing a text stream interface.
Comment 5 Murray Cumming 2008-03-10 14:55:59 UTC
I don't think this bug needs to be high priority or severity critical, but please tell me if I'm missing something.
Comment 6 Jonathon Jongsma 2008-03-10 18:19:23 UTC
no, you're not missing anything.  I'm not sure how they got set to those values.
Comment 7 GNOME Infrastructure Team 2018-05-22 12:08:24 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glibmm/issues/6.