Top: Basic types: variant: Utilities

>     #include <ptypes.h>

>     enum { VAR_NULL, VAR_INT, VAR_BOOL, VAR_FLOAT,
>            VAR_STRING, VAR_ARRAY, VAR_OBJECT };

>     void clear(variant&);
>     int  vartype(const variant&);

>     bool isnull(const variant&);
>     bool isint(const variant&);
>     bool isbool(const variant&);
>     bool isfloat(const variant&);
>     bool isstring(const variant&);
>     bool isarray(const variant&);
>     bool isobject(const variant&);

>     const variant nullvar;

void clear(variant&) clears the variant and sets its state to unassigned (null).

int vartype(const variant&) returns the type of a variant, which can be compared with one of the VAR_XXX constants.

bool isXXX(const variant&) this group of inlined functions is provided to check whether the variant is of particular type.

See also: Assignments and typecasts, Arrays, Object references

PTypes home