[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: "Steven T. Hatton" <hattons () globalsymmetry ! com>
Date: 2006-03-08 23:51:37
Message-ID: 200603081851.38288.hattons () globalsymmetry ! com
[Download RAW message or body]
On Wednesday 08 March 2006 02:18, Scott Cantor wrote:
> > I believe the second function is superfluous. Yes, I am depending on a
> > conversion from const char* to QString. As for the pointer becoming
> > invalid, that probably depends on what Xerces does with what I pass.
> > If the first
> > thing it does is copy it, then I'm home free. Or, at least that is my
> > understanding of the C++ Standard.
>
> Because it would wait to destruct the temp object until the outer function
> returns?
No. I'm really saying that it would be safe so long as the passed parameter
is used to initialize a variable which holds the same data.
> Maybe so, I'd never thought of trying it. It wouldn't have been my
> intuition, though.
You probably do it often, it just happens to be obvious in the example I
posted. I have now found what appears to be a cleaner and more convincing
approach:
const XMLCh* QtoX(const QString& s) { return (s.utf16()); }
QString XtoQ(const XMLCh* x) { return QString::fromUtf16(x); }
> > IIRC, there /are/ different UTF encodings, even within UTF-16.
> > There is something called UCS-4, and also something called UCS-2 (I
> > believe). I do not know the difference between these and their related
> > UTF-32 and UTF-16.
>
> Nor I, but that's what I had in mind when I expressed caution.
"The nice thing about standards is there are so many to chose from" -
variously attributed.
Steven
---------------------------------------------------------------------
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