🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

A new string type, CStdString ?

Started by
4 comments, last by WitchLord 18 years, 1 month ago
Dear All: How could I use an UNICODE String ? There is a modifided BSTR which could do this, but I don't like it. A few days ago, I found a CStdString call, which is more like MFC CString. (http://home.earthlink.net/~jmoleary/stdstring.htm) I suggest that this class could become the built-in string class. By the way, how to define a unicode string in script ? In VC, I could use _T("unicode"), but In angelscript, what should I do?
Advertisement
There is no builtin string class. To use a unicode string, just bind a unicode string.
As Deyja said, there is no built-in string type in AngelScript, so you can easily bind the CStdString if you want to use it. Take a look at the scriptstring.cpp that you'll find in the add_on directory.

The script language has no notion of unicode (at least not yet), but you could easily write the string factory to create a unicode string from the string defined in the script.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game


Thank you for your reply.

I am a little confused.

Since there is no built-in string type,
what is the purpose of asCString ?

Thanks!
It's just an example of binding a string.
Actually,

asCString is only the string class that I use internally in the library so that I do not have to rely on any outside libraries, not even STL. asCString is not exposed to the application.

Though if you wanted to you could use it from the application as well.

Even though the script string constants are stored in asCString, the string factory you register receive a simple char * as well as the length of the string so that the function doesn't have to deal with any unknown types.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement