Pepper_47_C_interfaces
Public Attributes | List of all members
PP_Var Struct Reference

#include <pp_var.h>

Collaboration diagram for PP_Var:
Collaboration graph

Public Attributes

PP_VarType type
 
int32_t padding
 
union PP_VarValue value
 

Detailed Description

The PP_VAR struct is a variant data type and can contain any value of one of the types named in the PP_VarType enum. This structure is for passing data between native code which can be strongly typed and the browser (JavaScript) which isn't strongly typed.

JavaScript has a "number" type for holding a number, and does not differentiate between floating point and integer numbers. The JavaScript operations will try to optimize operations by using integers when possible, but could end up with doubles. Therefore, you can't assume a numeric PP_Var will be the type you expect. Your code should be capable of handling either int32_t or double for numeric PP_Vars sent from JavaScript.

Definition at line 166 of file pp_var.h.

Member Data Documentation

int32_t PP_Var::padding

The padding ensures value is aligned on an 8-byte boundary relative to the start of the struct. Some compilers align doubles on 8-byte boundaries for 32-bit x86, and some align on 4-byte boundaries.

Definition at line 174 of file pp_var.h.

PP_VarType PP_Var::type

Definition at line 167 of file pp_var.h.

union PP_VarValue PP_Var::value

This value represents the contents of the PP_Var. Only one of the fields of value is valid at a time based upon type.

Definition at line 180 of file pp_var.h.

Referenced by PP_MakeBool(), PP_MakeDouble(), and PP_MakeInt32().


The documentation for this struct was generated from the following file: