Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-09-22 14:19:43


Rob Stewart wrote:
> From: John Torjo <john.lists_at_[hidden]>
>
>>Vladimir Prus wrote:
>>
>>>John Torjo wrote:
>>>
>>>
>>>>// write XML
>>>>std::cout << formatob(vp,
>>>> containerfmt("<elem> % </elem><elem> % </elem>",
>>>
>>>And how do you know what to output if there's only one element?
>>
>>Basically this is just a simper interface for the user.
>>The decorator will parse the string, which in the above case means:
>>
>>- open: "<elem> "
>>- seq : " </elem><elem> "
>>- close: " </elem>"
>
>
> BTW, that parsing can be to simply replace "%" with \0 and
> tracking the pointers to the start of each piece. Thus, no
> copying is needed.

of course, I just showed it as an example. There are many ways to
implement it ;)

>
>
>>But to the human eye, it's much easier to understand:
>>"<elem> % </elem><elem> % </elem>"
>>
>>than
>>"<elem> "," </elem><elem> "," </elem>"
>
>
> Agreed, but pipes ("|") are easier to grok:
>
> "<elem> | </elem><elem> | </elem>"
>

That's fine too.

Best,
John

-- 
John Torjo
-- john_at_[hidden]
Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.4 - save_dlg - true binding of your data to UI controls!
    + easily add validation rules (win32gui/examples/smart_dlg)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk