sgsString [class]
class sgsString
This is the string interface and handling class.
Variables
sgs_iStr* str
- the string data pointerSGS_CTX
(sgs_Context* C
) - associated context
Constructors
sgsString()
- initializes a NULL handlesgsString( const sgsString& h )
- initializes a handle from another handlesgsString( sgs_Context* c, sgs_iStr* s )
- initializes a handle from string data pointersgsString( sgs_Context* c, sgs_StkIdx item )
- initializes a handle from stack index if it has the right interface, otherwise handle is initialized to NULLsgsString( sgs_Context* c, sgs_Variable* var )
- initializes a handle from variable pointer if it has the right interface, otherwise handle is initialized to NULLsgsString( sgs_Context* c, const char* s, size_t sz )
- creates a new string buffer and sets the handle to itsgsString( sgs_Context* c, const char* s )
- creates a new 0-terminated string and sets the handle to it
Methods
const char* c_str()
- returns C string pointer or NULL for NULL handlessize_t size()
- returns string buffer size or 0 for NULL handlesbool get_string( std::string& out )
- creates a std::string for valid handles, returns if handle is valid (available only withSGS_CPPBC_WITH_STD_STRING
defined)int compare( const sgsString& s ) const
- compare this string with another one (strcmp return rules)bool same_as( const sgsString& s ) const
- returns if this string is exactly the same as the other stringbool equals( const char* s ) const
- returns if the specified C string is equal to this stringbool equals( const char* s, size_t sz ) const
- returns if the specified buffer is equal to this stringvoid push( sgs_Context* c = NULL ) const
- push the handle on the stack as string/nullbool not_null()
- returns if string handle points to a stringsgsVariable get_variable()
- returns this string as sgsVariablevoid _acquire()
- increment reference count on variablevoid _release()
- decrement reference count on variable, remove it from the class
Operators
const sgsString& operator = ( const sgsString& h )
- string assignmentbool operator <
,bool operator ==
,bool operator !=
- comparison operators