cannam@226
|
1 /*
|
cannam@226
|
2 Copyright 2011-2015 David Robillard <http://drobilla.net>
|
cannam@226
|
3
|
cannam@226
|
4 Permission to use, copy, modify, and/or distribute this software for any
|
cannam@226
|
5 purpose with or without fee is hereby granted, provided that the above
|
cannam@226
|
6 copyright notice and this permission notice appear in all copies.
|
cannam@226
|
7
|
cannam@226
|
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
cannam@226
|
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
cannam@226
|
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
cannam@226
|
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
cannam@226
|
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
cannam@226
|
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
cannam@226
|
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
cannam@226
|
15 */
|
cannam@226
|
16
|
cannam@226
|
17 #ifndef SORD_SORD_INTERNAL_H
|
cannam@226
|
18 #define SORD_SORD_INTERNAL_H
|
cannam@226
|
19
|
cannam@226
|
20 #include <stddef.h>
|
cannam@226
|
21 #include <stdint.h>
|
cannam@226
|
22
|
cannam@226
|
23 #include "sord/sord.h"
|
cannam@226
|
24
|
cannam@226
|
25 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
cannam@226
|
26 # define SORD_UNREACHABLE() __builtin_unreachable()
|
cannam@226
|
27 #else
|
cannam@226
|
28 # define SORD_UNREACHABLE() assert(false)
|
cannam@226
|
29 #endif
|
cannam@226
|
30
|
cannam@226
|
31 /** Resource node metadata */
|
cannam@226
|
32 typedef struct {
|
cannam@226
|
33 size_t refs_as_obj; ///< References as a quad object
|
cannam@226
|
34 } SordResourceMetadata;
|
cannam@226
|
35
|
cannam@226
|
36 /** Literal node metadata */
|
cannam@226
|
37 typedef struct {
|
cannam@226
|
38 SordNode* datatype; ///< Optional literal data type URI
|
cannam@226
|
39 char lang[16]; ///< Optional language tag
|
cannam@226
|
40 } SordLiteralMetadata;
|
cannam@226
|
41
|
cannam@226
|
42 /** Node */
|
cannam@226
|
43 struct SordNodeImpl {
|
cannam@226
|
44 SerdNode node; ///< Serd node
|
cannam@226
|
45 size_t refs; ///< Reference count (# of containing quads)
|
cannam@226
|
46 union {
|
cannam@226
|
47 SordResourceMetadata res;
|
cannam@226
|
48 SordLiteralMetadata lit;
|
cannam@226
|
49 } meta;
|
cannam@226
|
50 };
|
cannam@226
|
51
|
cannam@226
|
52 #endif /* SORD_SORD_INTERNAL_H */
|