summaryrefslogtreecommitdiffstats
path: root/include/zix/status.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/zix/status.h')
-rw-r--r--include/zix/status.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/zix/status.h b/include/zix/status.h
new file mode 100644
index 0000000..fcd45fb
--- /dev/null
+++ b/include/zix/status.h
@@ -0,0 +1,50 @@
+// Copyright 2016-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#ifndef ZIX_STATUS_H
+#define ZIX_STATUS_H
+
+#include "zix/attributes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ @defgroup zix Zix C API
+ @{
+ @defgroup zix_status Status Codes
+ @{
+*/
+
+/// A status code returned by functions
+typedef enum {
+ ZIX_STATUS_SUCCESS, ///< Success
+ ZIX_STATUS_ERROR, ///< Unknown error
+ ZIX_STATUS_NO_MEM, ///< Out of memory
+ ZIX_STATUS_NOT_FOUND, ///< Not found
+ ZIX_STATUS_EXISTS, ///< Exists
+ ZIX_STATUS_BAD_ARG, ///< Bad argument
+ ZIX_STATUS_BAD_PERMS, ///< Bad permissions
+ ZIX_STATUS_REACHED_END, ///< Reached end
+ ZIX_STATUS_TIMEOUT, ///< Timeout
+ ZIX_STATUS_OVERFLOW, ///< Overflow
+ ZIX_STATUS_NOT_SUPPORTED, ///< Not supported
+ ZIX_STATUS_UNAVAILABLE, ///< Resource unavailable
+} ZixStatus;
+
+/// Return a string describing a status code
+ZIX_CONST_API
+const char*
+zix_strerror(ZixStatus status);
+
+/**
+ @}
+ @}
+*/
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* ZIX_STATUS_H */