stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: SDO STL API
Date Tue, 21 Mar 2006 18:48:11 GMT
Edward Slattery wrote:
> Hi all,
> I want to replace the current C++ SDO interface with a C++ STL
> interface.
> Particularly, I want to have a means of loading XML strings into some
> stored
> string, and preserving the character set. I also want to provide a
> get/set
> API for data object which returns some form of string, not a char* as at
> present.
> I think the way to do that cleanly would be to create an SDOString
> class,
> which internally holds either a std::wstring, or a std::wstring*. This
> class
> would have minimal functionality such as operator=, construction from
> char*,
> construction from wchar_t* etc.
> Is this a good way to make progress?

It sounds doable to me :) The only caveat to keep in mind is that
std::string is a sequence of bytes (and std::wstring is a sequence
of wchar_t elements), and not a sequence of (potentially multibyte)
characters. E.g., string::length() has the same semantics as strlen()
and not mbslen().

If this is acceptable, it may not be necessary to introduce another
string class. Exposing std::string directly instead would make the
SDO API more readily interoperable with other APIs.

> I am assuming that I would be able to use stdcxx on linux and windows,
> and
> just put it ahead of the microsoft equivalent headers in the include
> path -
> is that OK?

Yes, that's pretty much how it works. On Linux it's also necessary
to use gcc instead of g++ to compile and link in order to avoid
linking with the native C++ Standard Library. The Windows compiler
provides a command line option that does the same.

Let us know how it goes!

View raw message