XLL+ Class Library

COper::ReadValue

Reads a single value from an COper or a cell of an array COper

[C++]
template< class T >
bool ReadValue(
   T& result,
   boolean bStrict = false
) const;

Parameters

result

If an appropriate value is found, then it is converted to the output type and placed in the variable referenced by this parameter.

If the argument cannot be converted, then the output variable will not be affected.

The following types are directly supported for T:

  • bool
  • long
  • unsigned long
  • int
  • unsigned int
  • short
  • unsigned short
  • double
  • float
  • CString
  • std::string
Any other type is treated as an enumerated type, and converted first to long and then to the specified type.

bStrict

If bStrict is set to true, then no attempt will be made to convert strings to numbers and vice versa. If bStrict is false (the default) then standard Excel type transformations will be used.

Return value

This function returns true or false as follows:

falseThe argument was of an unexpected type and could not be read.
trueThe value was present and correct, and the value of result was set.

Remarks

This template function lies at the core of all the other input conversion functions, including ReadVector(), ReadMatrix(), ReadOptional() and ReadGroupItem().

Requirements

Header: xllplus.h

See Also

COper Class | COper Methods