Browse Source

API docs for duk_xxx_prop_heapptr()

pull/1703/head
Sami Vaarala 7 years ago
parent
commit
09556280fd
  1. 1
      website/api/duk_del_prop.yaml
  2. 29
      website/api/duk_del_prop_heapptr.yaml
  3. 2
      website/api/duk_get_prop.yaml
  4. 30
      website/api/duk_get_prop_heapptr.yaml
  5. 2
      website/api/duk_get_prop_index.yaml
  6. 2
      website/api/duk_get_prop_lstring.yaml
  7. 2
      website/api/duk_get_prop_string.yaml
  8. 2
      website/api/duk_has_prop.yaml
  9. 31
      website/api/duk_has_prop_heapptr.yaml
  10. 1
      website/api/duk_has_prop_index.yaml
  11. 1
      website/api/duk_has_prop_lstring.yaml
  12. 1
      website/api/duk_has_prop_string.yaml
  13. 1
      website/api/duk_put_prop.yaml
  14. 30
      website/api/duk_put_prop_heapptr.yaml

1
website/api/duk_del_prop.yaml

@ -67,6 +67,7 @@ tags:
seealso:
- duk_del_prop_string
- duk_del_prop_lstring
- duk_del_prop_index
introduced: 1.0.0

29
website/api/duk_del_prop_heapptr.yaml

@ -0,0 +1,29 @@
name: duk_del_prop_heapptr
proto: |
duk_bool_t duk_del_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
stack: |
[ ... obj! ... ] -> [ ... obj! ... ]
summary: |
<p>Like <code><a href="#duk_del_prop">duk_del_prop()</a></code>, but the
property name is given as a Duktape heap pointer obtained e.g. using
<code><a href="#duk_get_heapptr">duk_get_heapptr()</a></code>. If
<code>ptr</code> is NULL, <code>undefined</code> is used as the key.</p>
example: |
duk_bool_t rc;
void *ptr;
duk_push_string(ctx, "propertyName");
ptr = duk_get_heapptr(ctx, -1);
/* String behind 'ptr' must remain reachable! */
rc = duk_del_prop_heapptr(ctx, -3, ptr);
printf("delete obj.propertyName -> rc=%d\n", (int) rc);
tags:
- property
introduced: 2.2.0

2
website/api/duk_get_prop.yaml

@ -80,6 +80,8 @@ tags:
seealso:
- duk_get_prop_string
- duk_get_prop_lstring
- duk_get_prop_index
- duk_get_prop_heapptr
introduced: 1.0.0

30
website/api/duk_get_prop_heapptr.yaml

@ -0,0 +1,30 @@
name: duk_get_prop_heapptr
proto: |
duk_bool_t duk_get_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
stack: |
[ ... obj! ... ] -> [ ... obj! ... val! ] (if key exists)
[ ... obj! ... ] -> [ ... obj! ... undefined! ] (if key doesn't exist)
summary: |
<p>Like <code><a href="#duk_get_prop">duk_get_prop()</a></code>, but the
property name is given as a Duktape heap pointer obtained e.g. using
<code><a href="#duk_get_heapptr">duk_get_heapptr()</a></code>. If
<code>ptr</code> is NULL, <code>undefined</code> is used as the key.</p>
example: |
void *ptr;
duk_push_string(ctx, "propertyName");
ptr = duk_get_heapptr(ctx, -1);
/* String behind 'ptr' must remain reachable! */
(void) duk_get_prop_heapptr(ctx, -3, ptr);
printf("obj.propertyName = %s\n", duk_to_string(ctx, -1));
duk_pop(ctx);
tags:
- property
introduced: 2.2.0

2
website/api/duk_get_prop_index.yaml

@ -19,7 +19,7 @@ summary: |
possible.</p>
example: |
duk_get_prop_index(ctx, -3, 123);
(void) duk_get_prop_index(ctx, -3, 123);
printf("obj[123] = %s\n", duk_to_string(ctx, -1));
duk_pop(ctx);

2
website/api/duk_get_prop_lstring.yaml

@ -12,7 +12,7 @@ summary: |
but the property name is given as a string with explicit length.</p>
example: |
duk_get_prop_lstring(ctx, -3, "internal" "\x00" "nul", 12);
(void) duk_get_prop_lstring(ctx, -3, "internal" "\x00" "nul", 12);
printf("obj.propertyName = %s\n", duk_to_string(ctx, -1));
duk_pop(ctx);

2
website/api/duk_get_prop_string.yaml

@ -13,7 +13,7 @@ summary: |
<code>key</code>.</p>
example: |
duk_get_prop_string(ctx, -3, "propertyName");
(void) duk_get_prop_string(ctx, -3, "propertyName");
printf("obj.propertyName = %s\n", duk_to_string(ctx, -1));
duk_pop(ctx);

2
website/api/duk_has_prop.yaml

@ -60,10 +60,10 @@ example: |
tags:
- property
- stack
seealso:
- duk_has_prop_string
- duk_has_prop_lstring
- duk_has_prop_index
introduced: 1.0.0

31
website/api/duk_has_prop_heapptr.yaml

@ -0,0 +1,31 @@
name: duk_has_prop_heapptr
proto: |
duk_bool_t duk_has_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
stack: |
[ ... obj! ... ] -> [ ... obj! ... ]
summary: |
<p>Like <code><a href="#duk_has_prop">duk_has_prop()</a></code>, but the
property name is given as a Duktape heap pointer obtained e.g. using
<code><a href="#duk_get_heapptr">duk_get_heapptr()</a></code>. If
<code>ptr</code> is NULL, <code>undefined</code> is used as the key.</p>
example: |
void *ptr;
duk_push_string(ctx, "propertyName");
ptr = duk_get_heapptr(ctx, -1);
/* String behind 'ptr' must remain reachable! */
if (duk_has_prop_heapptr(ctx, -3, ptr)) {
printf("obj has 'myProperty'\n");
} else {
printf("obj does not have 'myProperty'\n");
}
tags:
- property
introduced: 2.2.0

1
website/api/duk_has_prop_index.yaml

@ -26,6 +26,5 @@ example: |
tags:
- property
- stack
introduced: 1.0.0

1
website/api/duk_has_prop_lstring.yaml

@ -19,7 +19,6 @@ example: |
tags:
- property
- stack
seealso:
- duk_has_prop_string

1
website/api/duk_has_prop_string.yaml

@ -20,7 +20,6 @@ example: |
tags:
- property
- stack
seealso:
- duk_has_prop_lstring

1
website/api/duk_put_prop.yaml

@ -73,6 +73,7 @@ tags:
seealso:
- duk_put_prop_string
- duk_put_prop_lstring
- duk_put_prop_index
introduced: 1.0.0

30
website/api/duk_put_prop_heapptr.yaml

@ -0,0 +1,30 @@
name: duk_put_prop_heapptr
proto: |
duk_bool_t duk_put_prop_heapptr(duk_context *ctx, duk_idx_t obj_idx, void *ptr);
stack: |
[ ... obj! ... val! ] -> [ ... obj! ... ]
summary: |
<p>Like <code><a href="#duk_put_prop">duk_put_prop()</a></code>, but the
property name is given as a Duktape heap pointer obtained e.g. using
<code><a href="#duk_get_heapptr">duk_get_heapptr()</a></code>. If
<code>ptr</code> is NULL, <code>undefined</code> is used as the key.</p>
example: |
duk_bool_t rc;
void *ptr;
duk_push_string(ctx, "propertyName");
ptr = duk_get_heapptr(ctx, -1);
/* String behind 'ptr' must remain reachable! */
duk_push_string(ctx, "value");
rc = duk_put_prop_heapptr(ctx, -3, ptr);
printf("rc=%d\n", (int) rc);
tags:
- property
introduced: 2.2.0
Loading…
Cancel
Save