diff options
Diffstat (limited to 'include/serd/world.h')
-rw-r--r-- | include/serd/world.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/serd/world.h b/include/serd/world.h new file mode 100644 index 00000000..22ae57ed --- /dev/null +++ b/include/serd/world.h @@ -0,0 +1,51 @@ +// Copyright 2011-2022 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#ifndef SERD_WORLD_H +#define SERD_WORLD_H + +#include "serd/attributes.h" +#include "serd/error.h" + +SERD_BEGIN_DECLS + +/** + @defgroup serd_world World + @ingroup serd_library + @{ +*/ + +/// Global library state +typedef struct SerdWorldImpl SerdWorld; + +/** + Create a new Serd World. + + It is safe to use multiple worlds in one process, though no objects can be + shared between worlds. +*/ +SERD_MALLOC_API SerdWorld* SERD_ALLOCATED +serd_world_new(void); + +/// Free `world` +SERD_API void +serd_world_free(SerdWorld* SERD_NULLABLE world); + +/** + Set a function to be called when errors occur. + + The `error_func` will be called with `handle` as its first argument. If + no error function is set, errors are printed to stderr. +*/ +SERD_API void +serd_world_set_error_func(SerdWorld* SERD_NONNULL world, + SerdErrorFunc SERD_NULLABLE error_func, + void* SERD_NULLABLE handle); + +/** + @} +*/ + +SERD_END_DECLS + +#endif // SERD_WORLD_H |