| 1 |
// Copyright 2011-2015 David Robillard <[email protected]> |
| 2 |
// SPDX-License-Identifier: ISC |
| 3 |
|
| 4 |
#ifndef SORD_SORD_INTERNAL_H |
| 5 |
#define SORD_SORD_INTERNAL_H |
| 6 |
|
| 7 |
#include <serd/serd.h> |
| 8 |
#include <sord/sord.h> |
| 9 |
|
| 10 |
#include <stddef.h> |
| 11 |
|
| 12 |
#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ > 4) |
| 13 |
# define SORD_UNREACHABLE() __builtin_unreachable() |
| 14 |
#elif defined(_MSC_VER) |
| 15 |
# define SORD_UNREACHABLE() __assume(0) |
| 16 |
#else |
| 17 |
# define SORD_UNREACHABLE() |
| 18 |
#endif |
| 19 |
|
| 20 |
/** Resource node metadata */ |
| 21 |
typedef struct { |
| 22 |
size_t refs_as_obj; ///< References as a quad object |
| 23 |
} SordResourceMetadata; |
| 24 |
|
| 25 |
/** Literal node metadata */ |
| 26 |
typedef struct { |
| 27 |
SordNode* datatype; ///< Optional literal data type URI |
| 28 |
char lang[16]; ///< Optional language tag |
| 29 |
} SordLiteralMetadata; |
| 30 |
|
| 31 |
/** Node */ |
| 32 |
struct SordNodeImpl { |
| 33 |
SerdNode node; ///< Serd node |
| 34 |
size_t refs; ///< Reference count (# of containing quads) |
| 35 |
union { |
| 36 |
SordResourceMetadata res; |
| 37 |
SordLiteralMetadata lit; |
| 38 |
} meta; |
| 39 |
}; |
| 40 |
|
| 41 |
#endif /* SORD_SORD_INTERNAL_H */ |