MSFVariant
Objective-C
@interface MSFVariant : NSObject {
void *swigCPtr;
BOOL swigCMemOwn;
}
Swift
class MSFVariant : NSObject
JSON value. Can contain JSON-style structured data, including objects and arrays.
-
Checks if this object is equal to the specified object.
Declaration
Objective-C
- (BOOL)isEqual:(id)object;Swift
func isEqual(_ object: Any!) -> BoolParameters
objectThe reference object.
Return Value
True when objects are equal, false otherwise.
-
Returns the hash value of this object.
Declaration
Objective-C
- (NSUInteger)hash;Swift
func hash() -> UIntReturn Value
The hash value of this object.
-
Constructs a null Variant object.
Declaration
Objective-C
- (id)init;Swift
init!() -
Constructs Variant object from a boolean.
Declaration
Objective-C
- (id)initWithBoolVal:(BOOL)boolVal;Swift
init!(boolVal: Bool)Parameters
boolValThe boolean value.
-
Constructs Variant object from an integer.
Declaration
Objective-C
- (id)initWithLongVal:(long long)longVal;Swift
init!(longVal: Int64)Parameters
longValThe integer value.
-
Constructs Variant object from a double.
Declaration
Objective-C
- (id)initWithDoubleVal:(double)doubleVal;Swift
init!(doubleVal: Double)Parameters
doubleValThe double value.
-
Constructs Variant object from a string.
Declaration
Objective-C
- (id)initWithString:(NSString *)string;Swift
init!(string: String!)Parameters
stringThe string value.
-
Constructs Variant object from a list of values.
Declaration
Objective-C
- (id)initWithArray:(MSFVariantVector *)array;Swift
init!(array: MSFVariantVector!)Parameters
arrayThe array of JSON values.
-
Constructs Variant object from a map of values.
Declaration
Objective-C
- (id)initWithObject:(MSFStringVariantMap *)object;Swift
init!(object: MSFStringVariantMap!)Parameters
objectThe map of JSON values.
-
Returns the type of this variant.
Return Value
The type of this variant.
-
Returns the string value of this variant.
Declaration
Objective-C
- (NSString *)getString;Swift
func getString() -> String!Return Value
The string value of the variant. If the variant is not string, empty string will be returned.
-
Returns the boolean value of this variant.
Declaration
Objective-C
- (BOOL)getBool;Swift
func getBool() -> BoolReturn Value
The boolean value of the variant. If the variant is not boolean, false will be returned.
-
Returns the integer value of this variant.
Declaration
Objective-C
- (long long)getLong;Swift
func getLong() -> Int64Return Value
The integer value of the variant. If the variant is not integer, 0 will be returned.
-
Returns the floating point value of this variant.
Declaration
Objective-C
- (double)getDouble;Swift
func getDouble() -> DoubleReturn Value
The floating point value of the variant. If the variant is integer, it will be converted to floating point. Otherwise 0.0 is be returned.
-
Returns the number of elements in the array.
Declaration
Objective-C
- (int)getArraySize;Swift
func getArraySize() -> Int32Return Value
The number of elements in the array if the variant is of array type. Otherwise 0 is returned.
-
Returns the element of array at specified position.
Declaration
Objective-C
- (MSFVariant *)getArrayElement:(int)idx;Swift
func getArrayElement(_ idx: Int32) -> MSFVariant!Parameters
idxThe index of the array element to return (starting from 0).
Return Value
The array element at specified position or null type if the element does not exist or the variant is not an array.
-
Returns all the keys in the object.
Declaration
Objective-C
- (MSFStringVector *)getObjectKeys;Swift
func getObjectKeys() -> MSFStringVector!Return Value
The list containing all the keys of the object if the variant is of object type. Otherwise empty list is returned.
-
Returns true if object elements contains the specified key.
Declaration
Objective-C
- (BOOL)containsObjectKey:(NSString *)key;Swift
func containsObjectKey(_ key: String!) -> BoolParameters
keyThe key of the object element to check.
Return Value
True if the specified key exists in the object. If the element is not an object or the key does not exist, false is returned.
-
Returns the element of object with the specified key.
Declaration
Objective-C
- (MSFVariant *)getObjectElement:(NSString *)key;Swift
func getObjectElement(_ key: String!) -> MSFVariant!Parameters
keyThe key of the object element to return.
Return Value
The object element with the specified key or null type if the element does not exist or the variant is not an object.
-
Checks for equality between this and another variant object.
Declaration
Objective-C
- (BOOL)isEqualInternal:(MSFVariant *)var;Swift
func isEqualInternal(_ var: MSFVariant!) -> BoolParameters
varThe other variant object.
Return Value
True if equal.
-
Returns the hash value of this object.
Declaration
Objective-C
- (int)hashInternal;Swift
func hashInternal() -> Int32Return Value
The hash value of this object.
-
Converts the variant to JSON string.
Declaration
Objective-C
- (NSString *)description;Swift
func description() -> String!Return Value
The JSON string corresponding to the variant.
-
Creates a Variant object from a JSON string representation.
Declaration
Objective-C
+ (MSFVariant *)fromString:(NSString *)str;Swift
class func fromString(_ str: String!) -> MSFVariant!Parameters
strThe JSON string to use for the variant.
Return Value
The corresponding Variant object. @throws NSException If the string parsing fails.
-
Undocumented
Declaration
Objective-C
-(void)dealloc;Swift
func dealloc()