[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    RE: How do I use Xerces strings?
From:       "Scott Cantor" <cantor.2 () osu ! edu>
Date:       2006-03-10 1:34:14
Message-ID: 00a101c643e2$bd4b33d0$74f39280 () oit ! ohiostate ! edu
[Download RAW message or body]

> Well, I'm still learning the Standard Library, so I don't really know what
> I can get of the std::basic_string.  I know it has a bunch of seaching and

> manipulation functions.

What you lose is the ability to use the container classes and algorithms
effectively. Things like std::map function by having value-based keys, and
you can't use XMLCh* directly for that. This is more important overall than
the loss of a string class.

But in *practice*, you can use basic_string<unsigned short> if you're
willing to code an alternative for the compilers that don't support that
non-standard specialization, and if you're not using locale-oriented
functions on the string class (i.e. counting actual characters vs. counting
instances of the physical character type). This isn't as bad as it sounds,
especially now that gcc supports it again.

> I am under the impression that the stipulation you quoted only applies to 
> character literals. AFAIK Xerces-C doesn't support character literal of
> any kind.  Correct?

Xerces-C defines character constants for most of the common characters that
one uses to build string literals with. But there is no C++ *language*
construct that allows you to say "Foo" or L"Foo" and mean UTF-16.

Instead, you have to convert from ASCII "Foo" or use a static array of
constants defined in XMLUniDefs.hpp:

{ chLatin_F, chLatin_o, chLatin_o, chNull }

I use the array. As does Xerces itself.

-- Scott


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic