Boost logo

Boost :

From: AviadR (aviadr_at_[hidden])
Date: 2004-08-27 19:37:59


        I am (shamefully) a newbie. I want to suggest a tiny library I've
written that allows you to create
"tables" of textual strings.

What I mean is supposed you want to output rows of data that look like this

FIELD1 (tab) FIELD2 (tab) .... FIELD-N

Because many times the actual data that is written to the fields are of
different lengths,
You might get your output like this

Field1_data field2_data field3_data
Another_field1_data another_field2_data another_field3_data

Which is not very readble or conveniet.
The library I am proposing fixes this dire situation by defining a format,
which states for each field:
1. its 'width' or how many columns it takes
2. its length, how many characters can it hold altogether.

Data is written to a buffer using a special class which relies on the Format
* Lines within a field are broken down in order for the column invariant to
be preserved.
* if data written to a field is too long for the field, the output of the
field ends with "..." to indicate that the data was truncated.
* the classes uses NO dynamic memory whatsoever and are very fast.

If this is somehow interesting to someone I can spend the time 'boostfying'
And maybe factor some of the features stated above into Strategy classes.

So how about it?
I am attaching the relevant code here. IT WILL NOT COMPILE because it
currently relies on
My IO library, my string classes etc. of course if it is deemed interesting
I will change it to use boost's classes.


Boost list run by bdawes at, gregod at, cpdaniel at, john at