IlsMvValue
 
IlsMvValue
Category 
Dynamic view-related class (component and server)
Inheritance Path 
IlsMvValue
Description 
This class encapsulates the value of the runtime attributes attached to representation objects. The Rogue Wave Server internal protocol uses this class to transmit attribute values between an object server and an application component. Values of type IlsMvValue are also passed as parameters to the virtual callbacks to member functions in class IlsRpObject and to the function IlsMvComponent::execUserAsyncCallback.
Libraries 
<mvserver> and <mvcomp>
Header File 
<ilserver/mvvalue.h>
Synopsis 
class IlsMvValue
{
public:
Constructors/Destructor
IlsMvValue();
IlsMvValue(IlsBoolean val);
IlsMvValue(char val);
IlsMvValue(int val);
IlsMvValue(long val);
IlsMvValue(float val);
IlsMvValue(double val);
IlsMvValue(const char* val);
IlsMvValue(const IlsString& sharedStr);
IlsMvValue(IlsMvRef val);
IlsMvValue(const IlsMvUserType&);
IlsMvValue(const IlsMvValue& val);
IlsMvValue(const IlsMvFile&);
IlsMvValue(IlsSvRef&);
 
~IlsMvValue();
Assignment Operators
IlsMvValue& operator=(const IlsMvValue& val);
IlsMvValue& operator=(IlsBoolean val);
IlsMvValue& operator=(char val);
IlsMvValue& operator=(int val);
IlsMvValue& operator=(long val);
IlsMvValue& operator=(float val);
IlsMvValue& operator=(double val);
IlsMvValue& operator=(const IlsString&);
IlsMvValue& operator=(const char*);
IlsMvValue& operator=(IlsMvRef objRef);
IlsMvValue& operator=(const IlsMvUserType&);
IlsMvValue& operator=(const IlsMvFile&);
Accessors and Tests
IlsMvDataType getType()const;
IlsBoolean isVoid() const;
IlsBoolean isBoolean() const;
IlsBoolean isChar() const;
IlsBoolean isLong() const;
IlsBoolean isFloat() const;
IlsBoolean isDouble() const;
IlsBoolean isString() const;
IlsBoolean isRef() const;
IlsBoolean isHRef() const;
IlsBoolean isSvRef() const;
IlsBoolean isUserValue() const;
IlsBoolean isFile() const;
Controlled Conversion
IlsBoolean asBoolean(IlsBoolean direct=IlsFalse,
IlsBoolean defaultVal=0) const;
char asChar(IlsBoolean direct=IlsFalse,
char defaultVal=0) const;
long asLong(IlsBoolean direct=IlsFalse,
long defaultVal=0) const;
float asFloat(IlsBoolean direct=IlsFalse,
float defaultVal=0.0) const;
double asDouble(IlsBoolean direct=IlsFalse,
double defaultVal=0.0) const;
IlsString asString(IlsBoolean direct=IlsFalse,
IlsString defaultVal=(char*)0) const;
IlsMvRef asObjectRef(IlsBoolean direct=IlsFalse,
IlsMvRef defaultVal=(IlsRpObjectId)0) const;
IlsMvFile asFile(IlsBoolean direct=IlsFalse,
IlsMvFile defaultVal=IlsMvFile()) const;
IlsSvRef asSvObjectRef(IlsBoolean direct=IlsFalse,
IlsSvRef defaultVal=IlsSvRef()) const;
Conversion Operators
operator IlsBoolean() const;
operator char() const;
operator int() const;
operator long() const;
operator float() const;
operator double() const;
operator IlsString() const;
operator IlsMvRef() const;
operator IlsSvRef() const;
operator IlsMvUserType*() const;
operator IlsMvFile() const;
Comparison Operators
IlsBoolean operator ==(const IlsMvValue&) const;
IlsBoolean operator !=(const IlsMvValue&) const;
IlsBoolean operator <(const IlsMvValue&) const;
IlsBoolean operator >(const IlsMvValue&) const;
IlsBoolean operator <=(const IlsMvValue&) const;
IlsBoolean operator >=(const IlsMvValue&) const;
IlsBoolean operator !() const;
IlsMvValue& operator=(IlsSvRef objRef);
Insertion and Extraction Operators
friend IlsMvMessage& operator <<(IlsMvMessage&,
const IlsMvValue&);
friend IlsMvMessage& operator >>(IlsMvMessage&, IlsMvValue&);
};
Constructors 
IlsMvValue();
This default constructor creates an instance of IlsMvValue that contains no value.
IlsMvValue(IlsBoolean val);
This constructor creates an instance of IlsMvValue that contains the Boolean value val.
IlsMvValue(char val);
This constructor creates an instance of IlsMvValue that contains the value val of type char.
IlsMvValue(int val);
This constructor creates an instance of IlsMvValue that contains the integer val, which was first converted to a long integer.
IlsMvValue(long val);
This constructor creates an instance of IlsMvValue that contains the value val of type long.
IlsMvValue(float val);
This constructor creates an instance of IlsMvValue that contains the value val of type float.
IlsMvValue(double val);
This constructor creates an instance of IlsMvValue that contains the value val of type double.
IlsMvValue(const char* val);
This constructor creates an instance of IlsMvValue that contains an IlsString whose value is a copy of the string provided as its argument.
IlsMvValue(const IlsString& sharedStr);
This constructor creates an instance of IlsMvValue that contains an IlsString whose value is shared with sharedStr.
IlsMvValue(IlsMvRef val);
This constructor creates an instance of IlsMvValue that contains a copy of the val object, which references a representation object.
IlsMvValue(const IlsMvUserType&);
This constructor creates an instance of IlsMvValue that contains a pointer to the user value whose real type derives from IlsMvUserType.
IlsMvValue(const IlsMvValue& val);
This is a copy constructor. If the object contains a pointer to an IlsMvUserType, the IlsMvUserType instance is shared between the two IlsMvValues and its reference counter is increased.
IlsMvValue(const IlsMvFile& val);
This constructor creates an instance of IlsMvValue that contains a copy of the val object, which represents a file.
IlsMvValue(IlsSvRef&);
This constructor creates an instance of IlsMvValue that contains a copy of the val object, which references a server object.
Destructor 
~IlsMvValue();
If the object contains a pointer to an IlsMvUserType, the destructor of the pointed object is invoked.
Member Functions 
Assignment Operators
IlsMvValue& operator=(const IlsMvValue& val);
This operator assigns the value val to the object. If the object contains a pointer to an IlsMvUserType, the IlsMvUserType instance is shared between the two IlsMvValues and its reference counter is increased.
IlsMvValue& operator=(IlsBoolean val);
This operator assigns the Boolean value val to the value contained in the object.
IlsMvValue& operator=(char val);
This operator assigns the value val of type char to the value contained in the object.
IlsMvValue& operator=(int val);
This operator assigns the value val of type int to the value contained in the object after it was converted to a long integer.
IlsMvValue& operator=(long val);
This operator assigns the value val of type long to the value contained in the object.
IlsMvValue& operator=(float val);
This operator assigns the value val of type float to the value contained in the object.
IlsMvValue& operator=(double val);
This operator assigns the value val of type double to the value contained in the object.
IlsMvValue& operator=(const IlsString&);
This operator assigns the string passed as its argument to the value contained in the object.
IlsMvValue& operator=(const char*);
This operator assigns a copy of the string passed as its parameter to the value contained in the object.
IlsMvValue& operator=(IlsMvRef objRef);
This operator assigns the object reference passed as its parameter to the value contained in the object.
IlsMvValue& operator=(IlsSvRef objRef);
This operator assigns the server object reference passed as its parameter to the value contained in the object.
IlsMvValue& operator=(const IlsMvUserType&);
This operator assigns the pointer to the value contained in the object.
IlsMvValue& operator=(const IlsMvFile& file);
This operator assigns the file passed as its argument to the value contained in the object.
Accessors and Tests
IlsMvDataType getType() const;
This member function returns the type of the value contained in the object.
IlsBoolean isVoid() const;
This member function returns IlsTrue if there is no value contained.
IlsBoolean isBoolean() const;
This member function returns IlsTrue if no value is contained in the object.
IlsBoolean isChar() const;
This member function returns IlsTrue if the value contained in the object is of type char.
IlsBoolean isLong() const;
This member function returns IlsTrue if the value contained in the object is of type long.
IlsBoolean isFloat() const;
This member function returns IlsTrue if the value contained in the object is of type float.
IlsBoolean isDouble() const;
This member function returns IlsTrue if the value contained in the object is of type double.
IlsBoolean isString() const;
This member function returns IlsTrue if the value contained in the object is a character string.
IlsBoolean isRef() const;
This member function returns IlsTrue if the value contained in the object is a reference to a representation object.
IlsBoolean isHRef() const;
This member function returns IlsTrue if the value contained in the object is a hyper reference to a representation object.
IlsBoolean isSvRef() const;
This member function returns IlsTrue if the value contained in the object is a reference to a server object.
IlsBoolean isUserValue() const;
This member function returns IlsTrue if the value contained in the object is a pointer to an object that derives from IlsMvUserType.
IlsBoolean isFile() const;
This member function returns IlsTrue if the value contained in the object is a file.
Controlled Conversion
IlsBoolean asBoolean(IlsBoolean direct=IlsFalse,
IlsBoolean defaultVal=0) const;
This conversion operator returns the value contained in the object if that value is a Boolean type. Otherwise, it returns defaultVal if the direct argument is set to IlsTrue. If this argument is set to IlsFalse, the operator returns IlsTrue if:
*The value is numeric and different from 0.
*The value is a character different from 0.
*The value is of type IlsAny and different from 0.
*The value is of type IlsMvRef and different from 0.
*The value is a non-null character string.
If the value is of type IlsMvUserType*, it returns:
*defaultVal if there is no value contained in the object.
*the result of the virtual function IlsMvUserType::asBoolean applied to the pointed object.
char asChar(IlsBoolean direct=IlsFalse,
char defaultVal=0) const;
This conversion operator returns the value contained in the object if that value is a character. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:
*the result of the conversion of the value to a char if it is a Boolean or a numeric value.
*the first character in the string if the value is a non-null and non-empty character string.
If the value is of type IlsMvUserType*, it returns:
*defaultVal if there is no value contained in the object.
*the result of the virtual function IlsMvUserType::asChar applied to the pointed object.
*Otherwise, it returns defaultVal.
long asLong(IlsBoolean direct=IlsFalse,
long defaultVal=0) const;
This conversion operator returns the value contained in the object if that value is a long integer. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal.
If this argument is set to IlsFalse, the operator returns:
*the result of the conversion of the value to a long if it is a Boolean or numeric value to a character.
*the result of the extraction of a decimal value from the string if the value is a non-null and non-empty character string.
If the value is of type IlsMvUserType*, it returns:
*defaultVal if there is no value contained in the object.
*the result of the virtual function IlsMvUserType::asLong applied to the pointed object.
*Otherwise, it returns defaultVal.
float asFloat(IlsBoolean direct=IlsFalse,
float defaultVal=0.0) const;
This conversion operator returns the value contained in the object if that value is of type float. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal.
If this argument is set to IlsFalse, the operator returns:
*the result of the conversion of the value to float if it is a Boolean, a character or a numeric value.
*the result of the extraction of a floating point value from the sting if the value is a non-null and non-empty character string.
If the value is of type IlsMvUserType*, it returns:
*defaultVal if there is no value contained in the object.
*the result of the virtual function IlsMvUserType::asFloat applied to the pointed object.
*Otherwise, it returns defaultVal.
double asDouble(IlsBoolean direct=IlsFalse,
double defaultVal=0.0) const;
This conversion operator returns the value contained in the object if that value is of type double. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:
*the result of the conversion of the value to float if it is a Boolean, a character or a numeric value.
*the result of the extraction of a double precision floating point value if the value is a non-null and non-empty character string.
If the value is of type IlsMvUserType*, it returns:
*defaultVal if there is no value contained in the object.
*the result of the virtual function IlsMvUserType::asDouble applied to the pointed object.
*Otherwise, it returns defaultVal.
IlsString asString(IlsBoolean direct=IlsFalse,
IlsString defaultVal=(char*)0) const;
This conversion operator returns the value contained in the object if that value is a character string. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:
*if the value is Boolean, IlsTrue or IlsFalse depending on the value;
*the result of the insertion of the value into a string using sprintf with the following formats:
*%d if it is an integer,
*%l if it a long,
*%f if it is a float or a double,
*%xl if it is an IlsAny,
*if the value is a character, a string containing only this character;
*If the value is of type IlsMvUserType, it returns:
*defaultVal if there is no value contained in the object;
*the result of the virtual function IlsMvUserType::asString applied to the pointed object.
*Otherwise, it returns defaultVal.
IlsMvRef asObjectRef(IlsBoolean direct=IlsFalse,
IlsMvRef defaultVal=(IlsRpObjectId)0) const;
This conversion operator returns the value contained in the object if that value is of type IlsMvRef. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:
*the result of the virtual function IlsMvUserType::asObjectRef applied to the pointed object.
*defaultVal in any other case and especially if there is no value contained in the object.
IlsMvFile asFile(IlsBoolean direct=IlsFalse,
IlsMvFile defaultVal=IlsMvFile()) const;
The value returned by this conversion operator varies as follows:
*The operator returns the value contained in the object if that value is of type IlsMvFile.
*If that value is not of type IlsMvFile, the operator returns:
*defaultVal if the direct argument is set to IlsTrue, or
*one of the following values if the direct argument is set to IlsFalse:
* defaultVal if there is no value contained in the object;
* a new instance of IlsMvFile if the value contained in the object is a string, the contents of the string are passed to the constructor of IlsMvFile.
* defaultVal in any other case.
IlsSvRef asSvObjectRef(IlsBoolean direct=IlsFalse,
IlsSvRef defaultVal=IlsSvRef()) const;
This conversion operator returns the server object reference contained in the object if that value is of type IlsSvRef. Otherwise, if the direct argument is set to IlsTrue, it returns defaultVal. If this argument is set to IlsFalse, the operator returns:
*the result of the virtual function IlsMvUserType::asObjectRef applied to the pointed object.
*defaultVal in any other case and especially if there is no value contained in the object.
Conversion Operators
operator IlsBoolean() const;
This operator returns the result of asBoolean(IlsFalse, IlsFalse).
operator char() const;
This operator returns the result of asChar(IlsFalse, 0).
operator int() const;
This operator returns the result of asLong(IlsFalse, 0) after it was converted to an integer.
operator long() const;
This operator returns the result of asLong(IlsFalse, 0).
operator float() const;
This operator returns the result of asFloat(IlsFalse, 0.0).
operator double() const;
This operator returns the result of asDouble(IlsFalse, 0.0).
operator IlsString() const;
This operator returns the result of asString(IlsFalse, 0).
operator IlsMvRef() const;
This operator returns the result of asObjectRef(IlsFalse, 0).
operator IlsSvRef() const;
This operator returns the result of the conversion operator asSvObjectRef.
operator IlsMvUserType*() const;
This operator returns the pointer IlsMvUserType* if the value is of that type. Otherwise, it returns 0.
operator IlsMvFile() const;
This operator returns the result of the conversion operator asFile(IlsFalse, 0).
Comparison Operators
IlsBoolean operator ==(const IlsMvValue&) const;
This operator compares whether the value contained in the current object is equal to the value contained in the object passed as its parameter once this value has been converted to the current type.
If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator== that is applied to the pointed objects.
IlsBoolean operator !=(const IlsMvValue&) const;
This operator returns the inverse of the equality operator documented above.
IlsBoolean operator <(const IlsMvValue&) const;
This operator compares whether the value contained in the current object is smaller than the value contained in the object passed as its parameter once converted to the current type. Character strings are compared according to the alphabetical order.
If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator < that is applied to the pointed objects.
IlsBoolean operator >(const IlsMvValue&) const;
This operator compares whether the value contained in the current object is greater than the value contained in the object passed as its parameter once that value has been converted to the current type. Character strings are compared according to the alphabetical order.
If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator > that is applied to the pointed objects.
IlsBoolean operator <=(const IlsMvValue&) const;
This operator compares whether the value contained in the current object is smaller than or equal to the value contained in the object passed as its parameter once that value has been converted to the current type. Character strings are compared according to the alphabetical order.
If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator <= that is applied to the pointed objects.
IlsBoolean operator >=(const IlsMvValue&) const;
This operator compares whether the value contained in the current object is greater than or equal to the value contained in the object passed as its parameter once converted to the current type. Character strings are compared according to the alphabetical order.
If both values are of type IlsMvUserType*, the test returns IlsTrue if both pointers are null or IlsFalse if one of the two pointers is null. Otherwise, it returns the result of the operator IlsMvUserType::operator >= that is applied to the pointed objects.
IlsBoolean operator !() const;
This operator returns IlsTrue if the value contained in the object is different from 0.
If the value is of type IlsMvUserType*, the test returns IlsFalse if the pointer is null. Otherwise, it returns the result of the operator IlsMvUserType::operator! that is applied to the pointed object.
Insertion and Extraction Operators
friend IlsMvMessage& operator <<(IlsMvMessage&,
const IlsMvValue&);
This operator inserts an IlsMvValue into an IlsMvMessage used to exchange information between the server and the application components. If the value contained in an IlsMvValue is an instance of a subclass of IlsMvUserType, the virtual member function IlsMvUserType::ilsEncode is executed to encode this instance.
friend IlsMvMessage& operator >>(IlsMvMessage&, IlsMvValue&);
This operator extracts an IlsMvValue from an IlsMvMessage. If the value contained in an IlsMvValue is an instance of a subclass of IlsMvUserType, the static member function IlsMvUserType::ilsDecode is executed to encode this instance.
See Also 
IlsMvComponent, IlsMvUserType, IlsRpAttrModel, IlsRpObject

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.