updf_propval_newΒΆ
updf_propval_new creates a new property value object.
- propval = updf_propval_new()
Return Value
propval is a pointer to a propval object or a number with the value 0 (error).
Parameters
- data
data is a scalar, vector or matrix (real or string).
- data_type
data_type is one of the following values:
Wert |
Bedeutung |
---|---|
UPDF_INT8 |
8-Bit signed integer (-127..128). |
UPDF_UINT8 |
8-Bit unsigned integer (0..255). |
UPDF_INT16 |
16-Bit integer. |
UPDF_UINT16 |
16-Bit integer (unsigned). |
UPDF_INT32 |
32-Bit integer. |
UPDF_UINT32 |
32-Bit integer (unsigned). |
UPDF_INT64 |
64-Bit integer. |
UPDF_UINT64 |
64-Bit integer (unsigned). |
UPDF_FLOAT |
32-Bit real value. |
UPDF_DOUBLE |
64-Bit real value. |
UPDF_STRING |
Unicode string saved as UTF-8. |
UPDF_BLOB |
Stream of bytes. data must be a string. |
Comment
For the types UPDF_INT8
to UPDF_DOUBLE
data must be scalar, vector
of matrix of numbers.
For the type UPDF_STRING
data must be a valid Unicode string.
For the type UPDF_BLOB
data must a string value without valid Unicode
characters. Null characters are valid. The mem_set function can be used to
create the data.
Example
def test_updf_propval_new()
{
pv = updf_propval_new(1.23);
r = updf_propval_get(pv);
if (r != 1.23) {
error();
}
pv = updf_propval_new(123, UPDF_INT8);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_UINT8);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_INT16);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_UINT16);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_INT32);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_UINT32);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_INT64);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_UINT64);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_FLOAT);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new(123, UPDF_DOUBLE);
r = updf_propval_get(pv);
if (r != 123) {
error();
}
pv = updf_propval_new("123", UPDF_STRING);
r = updf_propval_get(pv);
if (r != "123") {
error();
}
pv = updf_propval_new("123", UPDF_BLOB);
r = updf_propval_get(pv);
if (r != "123") {
error();
}
}
test_updf_propval_new();
History
Version |
Description |
---|---|
5.6.0 |
New |
id-1298911