FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Socket.accept().isTextual()?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Tue May 23, 2006 1:29 pm    Post subject: Reply with quote

kris wrote:
BTW: if you just want a single line of input, then you can dispense with the foreach() and instead do a get() on the LineIterator instance. This will simply wait until there's either a line available in the input or an eof is encountered. The foreach() is just a wrapper around get(). Oh, and you can reuse a LineIterator instance via the various set...() methods.


Thanks for the get() suggestion. Also, I'm not worried anymore about creating new LineIterators because I can just reuse the same over and over again. Very Happy

kris wrote:
I thought about having an output equivalent of Iterator, but couldn't come up with anything compelling. If you have some ideas, please make them known Smile


My gut feeling is that there is no output equivalent of Iterator (I had an idea about how to explain it, but I lost it...)

kris wrote:
Currently there's at least three (layered) ways to output content to a conduit, from lowest level to highest:

* conduit.write()
* buffer.append()
* writer.put()

The latter handles various conversion as necessary (including unicode conversion), whereas the former two are simple unformatted output using void[] arguments. If you don't need conversion, the former two are more appropriate, with the middle (buffered) one probably being the right balance for common designs.


writer.put () is what I want, but I want a DisplayWriter or a TextWriter to use with a SocketConduit. That's it. Wink
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Tue May 23, 2006 1:34 pm    Post subject: Reply with quote

kris wrote:
Carlos wrote:
Ok, now that I have a working trunk, is this how I should do the original example?
Code:

auto reader = new TextReader (new NumericParser (new LineIterator (client)), new UnicodeExporter!(char) ());

I'm sorry but, are you kidding me? Worst is, I don't even know if that's going to work.

I've no idea why anyone would wish to do such a thing with a socket Smile


I almost forgot about this: forget that this is about a SocketConduit: it's just a Conduit. Forget it's about reading line by line: someone just wants to use a TextReader with a Conduit. Is this how it should be done?

Code:

auto reader = new TextReader (new NumericParser (new SomeIterator (conduit)), new UnicodeExporter!(char) ());


If not, how? If yes, shouldn't it be simpler? If one can just use SomeIterator, what's the purpose of TextReader?
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue May 23, 2006 1:41 pm    Post subject: Reply with quote

Readers and Iterators are used for quite different purposes. But the TextReader should certainly be easier to instantiate. Next release will have something better.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue May 23, 2006 4:04 pm    Post subject: Reply with quote

Carlos wrote:
Anyway, I'm ok with reading with Iterators now

I should note that an Iterator slices the content (as noted in the doc) so your application may, or may not, need to .dup the returned slice ~ just an FYI Smile
Back to top
View user's profile Send private message
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Tue May 23, 2006 6:08 pm    Post subject: Reply with quote

kris wrote:
Readers and Iterators are used for quite different purposes. But the TextReader should certainly be easier to instantiate. Next release will have something better.

Thanks!
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Carlos



Joined: 19 Mar 2004
Posts: 396
Location: Canyon, TX

PostPosted: Tue May 23, 2006 6:10 pm    Post subject: Reply with quote

kris wrote:
Carlos wrote:
Anyway, I'm ok with reading with Iterators now

I should note that an Iterator slices the content (as noted in the doc) so your application may, or may not, need to .dup the returned slice ~ just an FYI Smile

Thanks for the reminder Smile
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group