Values

Access to XPE values from external C++ functions
All XPE values are tagged to indicate the type of value that they hold. (see types for a discussion on the types of values that can be stored and manipulated).
Simple access to XPE value
as an integer
as a float
as a string
Converting a basic C value to an XPE value
C integer to XPE integer
C float to XPE float
C string to XPE string
Coercion from a basic C value to an XPE value
C integer to XPE integer
C float to XPE float
C string to XPE string
Access to XPE value depending on type
Accessing an element from an XPE array value
as an integer element
as a float element
as a string element
as an XPE value element
as an XPE variable element
Accessing a member of an XPE structure value
as an integer member
as a float member
as a string member
as an XPE value member
as an XPE variable member

 

simple access to XPE value

given the XPE value xval is defined as:

	XPE::VALUE  xval
Then access will be:

 

converting a basic C value to an XPE value

given the XPE value xval is defined as:

	XPE::VALUE  xval
Then access will be:

 

coercion from a basic C value to an XPE value

 

access to XPE value depending on type

given the XPE value xval is defined as:

	XPE::VALUE  xval
Then access will be:
	int	xint;

	float	xfloat;

	const char
		*xstr;


	switch (xval.get_type())
	{
	case XPE::VALUE_INT:
		// using xval as an integer
		xint = xval.get_int();
		printf("xval is an int (%d)\n", xint);
		break;

	case XPE::VALUE_FLOAT:
		// using xval as a float
		xfloat = xval.get_float();
		printf("xval is a float (%f)\n", xfloat)
		break;

	case XPE::VALUE_STR:
		// using xval as a string
		xstr = xval.get_str();
		printf("xval is a string (%s)\n", xstr);
		break;

	default:
		// do nothing
		printf("xval is of type %d\n", xval.get_type());
	}

 

accessing an element from an XPE array value

given the XPE value xval is defined as:

	XPE::VALUE  xval
Then access will be:

 

accessing a member of an XPE structure value

given the XPE value xval is defined as:

	XPE::VALUE  xval
Then access will be: