[openbeos] Re: BString

  • From: rafasgj@xxxxxxxxxxxxxxxxxx
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Mon, 12 Nov 2001 15:01:19 -0200

On Mon, 12 Nov 2001 14:35:08 +0000
"Marcus Overhagen" <dos4gw@xxxxxx> wrote:

MO> No, it's not undocumented. BString is for storing strings, and a
MO> string in C or C++ is always terminated by one zero byte. 

Hmmm...  In C ok, in C++ it could terminate in the last character stored.
You could implement std::string as a Pascal-like string which is stored as
{[size][data]} adn it would still be std::string.

It is the c_str() method that converts C++ strings into C char pointers.

MO> Bstring is only for "char *" strings, not for the "wchar_t *" ones!
MO> If you have UTF-16 as input, this means the terminator is 
MO> a wchar_t zero, and all other characters are wchar_t != 0
MO> But this is not for use with the BString class.
MO> To handle them, you could create a BWideString class,
MO> or you simply convert them into UTF-8.

Sorry fo my ignorance about Be API, I have used BeOS, not programmed for
it(well, I can't say OpenGL and Glut programming is FOR BeOS), but
couldn't BString "implemented-in-terms-of" std::string ?

Or maybe a templatized BString, which can be eithe BString<char> or
BString<wchar_t> ?

-- Rafael Guterres Jeffman
-- rafasgj@xxxxxxxxxxxx
-- www.cscience.org/~rafasgj
-- ICQ# 55885919
-- "The way your heart sounds
--    makes all the difference
--  It's what decides if you'll endure
--    the pain that we all feel
--  The way your heart sounds
--    makes all the difference
--  In learning to live"
--                    -- Dream Theater

Other related posts: