SBM ModScript Reference → Programming SBM ModScript → Object Types → Variant
A class that wraps multiple data types, especially for scripts that are converted from SBM AppScript to SBM ModScript.
The following data types can be represented by Variant:
Variant(): Creates an empty Variant object.
Variant( Variant v ): Copies v; if v is an object, the new Variant will contain a reference to the object.
Variant( bool v ): Copies v.
Variant( double v ): Copies v.
Variant( short v ): Copies v.
Variant( int v ): Copies v.
Variant( int64_t v ): Copies v.
Variant( uint64_t v ): Copies v.
Variant( string v ): Copies v.
Copy operators:
Variant& operator =( Variant v ): Sets current Variant to value v; if v is an object, the current Variant will contain a reference to the object.
Variant& operator =( bool v ): Sets current Variant to value v.
Variant& operator =( double v ): Sets current Variant to value v.
Variant& operator =( short v ): Sets current Variant to value v.
Variant& operator =( int v ): Sets current Variant to value v.
Variant& operator =( int64_t v ): Sets current Variant to value v.
Variant& operator =( uint64_t v ): Sets current Variant to value v.
Variant& operator =( string v ): Sets current Variant to value v.
Math operators:
Variant operator +( Variant v1 , Variant v2 ): Adds the value v1 to the value v2 and returns a Variant of the results.
Variant operator -( Variant v1 , Variant v2 ): Subtracts the value v2 from the value v1 and returns a Variant of the results.
Variant operator /( Variant v1 , Variant v2 ): Divides the value v1 by the value v2 and returns a Variant of the results. Throws exception if v equals 0.
Variant operator *( Variant v1 , Variant v2 ): Multiplies the value v1 by the value v2 and returns a Variant of the results.
Variant operator %( Variant v1 , Variant v2 ): Divides the value v1 by the value v2 and returns a Variant of the remainder. Throws exception if v equals 0.
Variant operator ^( Variant v1 , Variant v2 ): Performs a bitwise exclusive OR using the value v1 and value v2 and returns a Variant of the results.
Comparison operators:
bool operator ==( Variant v1 , Variant v2 ): Returns true if v1 is equal to v2.
bool operator !=( Variant v1 , Variant v2 ): Returns true if v1 is not equal to v2.
bool operator <( Variant v1 , Variant v2 ): Returns true if v1 is less than v2.
bool operator >( Variant v1 , Variant v2 ): Returns true if v1 is greater than v2.
bool operator <=( Variant v1 , Variant v2 ): Returns true if v1 is less than or equal to v2.
bool operator >=( Variant v1 , Variant v2 ): Returns true if v1 is greater than or equal to v2.
Other operators:
Variant& operator +=( Variant v ): Adds the value v to the current Variant.
Variant& operator ++(): Increments the value of the current Variant by one.
SBM AppScript conversion operators:
Variant operator vbEQV( Variant v1 , Variant v2 ): Performs SBM AppScript EQV.
Variant operator vbIMP( Variant v1 , Variant v2 ): Performs SBM AppScript IMP.
Variant operator vbAND( Variant v1 , Variant v2 ): Performs SBM AppScript AND.
Variant operator vbOR( Variant v1 , Variant v2 ): Performs SBM AppScript OR.
Variant operator vbXOR( Variant v1 , Variant v2 ): Performs SBM AppScript XOR.
Variant operator !vbNOT!( Variant v ): Performs SBM AppScript NOT.
Variant operator is( Variant v1 , Variant v2 ): Performs SBM AppScript is.
Conversion methods:
string to_string()
int to_int()
bool to_bool()
double to_double()
float to_float()
long to_long()
unsigned_int to_unsigned_int()
unsigned_long to_unsigned_long()
long_long to_long_long()
unsigned_long_long to_unsigned_long_long()
size_t to_size_t()
int8_t to_int8_t()
int16_t to_int16_t()
int32_t to_int32_t()
int64_t to_int64_t()
uint8_t to_uint8_t()
uint16_t to_uint16_t()
uint32_t to_uint32_t()
uint64_t to_uint64_t()
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.