Request for Discussion: SAX 1.0 in C++

Steve Harris sharris at primus.com
Tue Dec 21 17:35:42 GMT 1999


Steinar Bang wrote:
> Sure, but how about this, then...?
> 
> typedef unsigned short SAXChar;
> class SAXString : public basic_string<SAXChar> {
> public:
>     SAXString(const SAXString& s, size_type pos = 0, size_type n = npos)
> 	: basic_string<SAXChar>(s,pos,npos) {}
>     SAXString(const SAXChar* p, size_type n)
> 	: basic_string<SAXChar>(p,n) {}
>     SAXString(const SAXChar* p)
> 	: basic_string<SAXChar>(p) {}
>     SAXString(size_type n, SAXChar c)
> 	: basic_string<SAXChar>(n,c) {}
>     SAXString(const char* p)
> 	: basic_string<SAXChar>(p)
>     {
> 	// do UTF-8 to UTF-16 decoding here
>     }
>     
> };

This UTF-8/UTF-16 representation translation seems like a job for Standard
C++'s <locale>/codecvt facility, not something to be embedded in a string
class.
Here's a couple of somewhat relevant Usenet postings that may encourage you
to investigate a more appropriate solution:

http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=530606635&fmt=text
http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=530837402&fmt=text


Steven E. Harris
Senior Software Engineer
PRIMUS

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