NvDialog 0.10.1
A cross-platform modal dialogs library for C/C++ that uses the native OS theme.
Loading...
Searching...
No Matches
nvdialog_error.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2022 Aggelos Tselios
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25#pragma once
26
27#ifndef __nvdialog_error_h__
28#define __nvdialog_error_h__ 1
29
30#include "nvdialog_platform.h"
31#include "nvdialog_string.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
37/**
38 * @brief An enumerator describing possible errors that may occur from the library.
39 * One of its fields is returned by `nvd_get_error` depending on whether a (and what)
40 * problem might've occured after an operation.
41 * @sa nvd_stringify_error
42 * @since v0.1.0
43 */
44typedef enum {
57} NvdError;
58
59/**
60 * @brief Returns the current error code of the library.
61 *
62 * The error code has to be manually be transformed into a string
63 * using @ref nvd_stringify_error. Else, use the @ref NvdError enum to check for
64 * the error manually.
65 *
66 * @ingroup Error
67 * @returns The error code (Will be automatically 0 if no errors were
68 * encountered).
69 */
71
72/**
73 * @brief Transforms an error code into a string representation, that can be
74 * used to print errors to the console.
75 * @returns A @ref NvdDynamicString containing the error as a string, or NULL in case of failure or invalid parameter.
76 * @ingroup Error
77 * @note Pre v0.10 code may not work with this function due to different return types.
78 */
80
81#ifdef __cplusplus
82}
83#endif /* __cplusplus */
84
85#endif /* __nvdialog_error_h__ */
NVD_API NvdError nvd_get_error(void)
Returns the current error code of the library.
NvdError
An enumerator describing possible errors that may occur from the library. One of its fields is return...
Definition: nvdialog_error.h:44
@ NVD_NO_DISPLAY
Definition: nvdialog_error.h:46
@ NVD_STRING_EMPTY
Definition: nvdialog_error.h:52
@ NVD_FILE_INACCESSIBLE
Definition: nvdialog_error.h:51
@ NVD_NOT_INITIALIZED
Definition: nvdialog_error.h:49
@ NVD_UNSUPPORTED_ACTION
Definition: nvdialog_error.h:56
@ NVD_OUT_OF_MEMORY
Definition: nvdialog_error.h:53
@ NVD_BACKEND_INVALID
Definition: nvdialog_error.h:50
@ NVD_INVALID_PARAM
Definition: nvdialog_error.h:48
@ NVD_ALREADY_INITIALIZED
Definition: nvdialog_error.h:55
@ NVD_INTERNAL_ERROR
Definition: nvdialog_error.h:54
@ NVD_BACKEND_FAILURE
Definition: nvdialog_error.h:47
@ NVD_NO_ERROR
Definition: nvdialog_error.h:45
NVD_API NvdDynamicString * nvd_stringify_error(NvdError err)
Transforms an error code into a string representation, that can be used to print errors to the consol...
#define NVD_API
Definition: nvdialog_platform.h:57
struct _NvdDynamicString NvdDynamicString
A string type that can be resized, manipulated, converted and read from.
Definition: nvdialog_string.h:64