On Thu, 2 Dec 2004, Bob Jamison wrote:
Can you show us an example of the before/after code? I'm curious what the existing code looks like, and how it'll get streamlined with the new stuff.
I'll paste below what repr-io.cpp's output section would look like with streams (omitting some stuff). It is just an example. I would expect that we would have something like Inkscape::IO::ostream or ozstream. But I have actually tested it, and it works, and does .svgz without a pipe. It looks very readable to me, at least (at least as well as the previous printfs). Note how save_file() and save_file_gzip() can now use the same code.
Hmm, yeah... Looks like for this case the need is less about formatting output and more for passing streams around from function to function, so streams does better at that. Of course, performance may need to be considered, but this only occurs at file load/save, right? So slight performance changes there may not be a problem even if they exist.
Also, take a look at my ftos code - this was written as a part of a iostream subclassing thing I did, and worked pretty good. I'd love to see this incorporated since it provides a better approach to formatting numbers (so you can say x="4.21" instead of x="4.209999999").
I think it would fit in easily as the code that implements the operator overload for <<(double) and <<(float)
*Nod*
Actually I found it particularly useful to implement it such that you can pass parameters to it (e.g., for num of sig figs, precision, or how to handle exponents, or etc.)
Bryce