Variant

toInt64() [Variant class]

Returns the value of the variant to an int64_t (64-bit signed integer), converting the type if necessary. The original value is left unchanged.

Source Result
bool false → 0, true → 1
numeric unchanged
String string number → 64-bit signed integer
other conversion fails

There are two overloads, one that takes an ok parameter passed by reference, which is filled in as true if the data is already this type or can be converted.

// PROTOTYPES
int64_t toInt64() const;
int64_t toInt64(bool& ok) const;

See value, as, and to for when to use the toXXX() vs. other accessors.