1 module deimos.cbor.tags;
2 
3 import deimos.cbor.data;
4 
5 /*
6  * Copyright (c) 2014-2019 Pavel Kalvoda <me@pavelkalvoda.com>
7  *
8  * libcbor is free software; you can redistribute it and/or modify
9  * it under the terms of the MIT license. See LICENSE for details.
10  */
11 
12 extern (C):
13 
14 /*
15  * ============================================================================
16  * Tag manipulation
17  * ============================================================================
18  */
19 
20 /** Create a new tag
21  *
22  * @param value The tag value. Please consult the tag repository
23  * @return **new** tag. Item reference is `NULL`. Returns `NULL` upon
24  *      memory allocation failure
25  */
26 cbor_item_t* cbor_new_tag(ulong value);
27 
28 /** Get the tagged item
29  *
30  * @param item[borrow] A tag
31  * @return **incref** the tagged item
32  */
33 cbor_item_t* cbor_tag_item(const cbor_item_t* item);
34 
35 /** Get tag value
36  *
37  * @param item[borrow] A tag
38  * @return The tag value. Please consult the tag repository
39  */
40 ulong cbor_tag_value(const cbor_item_t* item);
41 
42 /** Set the tagged item
43  *
44  * @param item[borrow] A tag
45  * @param tagged_item[incref] The item to tag
46  */
47 void cbor_tag_set_item(cbor_item_t* item, cbor_item_t* tagged_item);
48 
49 /** Build a new tag
50  *
51  * @param item[incref] The tagee
52  * @param value Tag value
53  * @return **new** tag item
54  */
55 cbor_item_t* cbor_build_tag(ulong value, cbor_item_t* item);