CANCapture Scripting
|
Path: /sdk/add_on/scriptstdstring/
This add-on registers the std::string
type as-is with AngelScript. This gives perfect compatibility with C++ functions that use std::string
in parameters or as return type.
A potential drawback is that the std::string
type is a value type, thus may increase the number of copies taken when string values are being passed around in the script code. However, this is most likely only a problem for scripts that perform a lot of string operations.
Register the type with RegisterStdString(asIScriptEngine*)
.
Refer to the std::string
implementation for your compiler.
class string { // Constructors string();
// Returns the length of the string uint length() const;
// The string class has several operators that are not expressable in the script syntax yet
// Assignment and concatenation // string & operator = (const string &in other) // string & operator += (const string &in other) // string operator + (const string &in a, const string &in b)
// Access individual characters // uint8 & operator [] (uint) // const uint8 & operator [] (uint) const
// Comparison operators // bool operator == (const string &in a, const string &in b) // bool operator != (const string &in a, const string &in b) // bool operator < (const string &in a, const string &in b) // bool operator <= (const string &in a, const string &in b) // bool operator > (const string &in a, const string &in b) // bool operator >= (const string &in a, const string &in b)
// Automatic conversion from number types to string type // string & operator = (double val) // string & operator += (double val) // string @ operator + (double val, const string &in str) // string @ operator + (const string &in str, double val) // string & operator = (int val) // string & operator += (int val) // string @ operator + (int val, const string &in str) // string @ operator + (const string &in str, int val) // string & operator = (uint val) // string & operator += (uint val) // string @ operator + (uint val, const string &in str) // string @ operator + (const string &in str, uint val) }