Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #553 (assigned enhancement)

Opened 1 year ago

Last modified 4 months ago

Difficulties working with tango.io.MemoryConduit and tango.text.stream.LineIterator

Reported by: Nietsnie Assigned to: kris (accepted)
Priority: normal Milestone: 1.0
Component: Core Functionality Version: 0.99 RC3 Xammy
Keywords: LineIterator MemoryConduit seek position triage Cc:

Description

During the process of moving some existing phobos code to tango, I encountered some issues with the current design of some of the IO components of tango. The existing phobos code was a mime parser.

1. The ability to seek in conduits. FileConduit? supports this, I had to make a new MemoryConduit? to do this, as I wanted to be able to seek to a specific part of the MemoryConduit? and read an exact amount of data during parsing. I'm unsure if this type of behavior is what was intended for the MemoryConduit?.

2. The ability to find my position of the underlying stream using an iterator. I've implemented this using the attached LineIterator?. It seems to work with both Memory and File conduits.

3. The ability to reverse a stream iterator (LineIterator? in this case). Kris added a new function "push" that allows you to push one token back on the Iterator, which solved my specific problem. However, this may need to be extended, as parsing a file can require moving backwards some amount due to recursion, etc.

I've attached the two modified files as examples of what I needed to do to finish implementation of this module. I didn't go over them to see if they much the "contributing guidelines" as I think of them more as a suggestion and not anything concrete.

Attachments

LineIteratorEnhanced.d (5.9 kB) - added by Nietsnie on 07/31/07 18:27:17.
Example LineIterator? with above features.
MemoryConduitEnhanced.d (2.9 kB) - added by Nietsnie on 07/31/07 18:28:16.
Example MemoryConduit? with the above implementation

Change History

07/31/07 18:27:17 changed by Nietsnie

  • attachment LineIteratorEnhanced.d added.

Example LineIterator? with above features.

07/31/07 18:28:16 changed by Nietsnie

  • attachment MemoryConduitEnhanced.d added.

Example MemoryConduit? with the above implementation

07/31/07 18:49:04 changed by sean

  • owner changed from sean to kris.

08/04/07 09:50:56 changed by larsivi

  • milestone changed from 0.99 RC3 to 0.99.1 RC4.

08/28/07 02:21:16 changed by kris

  • status changed from new to assigned.

09/07/07 04:18:59 changed by larsivi

  • milestone changed from 0.99.1 RC4 to 0.99.2 RC5.

09/29/07 15:31:31 changed by kris

  • milestone changed from 0.99.2 RC5 to 1.0.

05/24/08 15:32:42 changed by larsivi

  • keywords changed from LineIterator MemoryConduit seek position to LineIterator MemoryConduit seek position triage.