SAX/C++: First interface draft

John Aldridge john.aldridge at informatix.co.uk
Mon Dec 6 11:30:43 GMT 1999


At 10:06 06/12/99 +0100, Steinar Bang <sb at metis.no> wrote:
>After thinking over the weekend, I'm changing my vote on this issue.
>I think the convenience of using basic_string<> way outweighs the
>cost advantages of lazy conversion,

Agreed.

>But the UTF-16 string should not be a straight typedef.  We should
>derive from basic_string<SAXChar> to get a char* constructor that
>would take a UTF-8-encoded string.  This is for ease of use with
>character constants.

I disagree with this, though.  It's not that much of a hardship to add an
"L" before your character constants; certainly not enough to warrant
subclassing a class without a virtual dtor (and duplicating all the
constructors and all the functions which return a string as a function
result).

I think I'd go for using straight std::wstring, and define the characters
in those wstrings to be UTF-16 encoded (whatever the current C locale
says).  Leave it up to the application either to set a locale in which
wchar_t is UTF-16 (in which case the RTL functions will behave sensibly),
or not (in which case the application will have to hand crank some things).
-- 
Cheers,
John

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list