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) 2025 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#include "nvdialog_string.h"
28#ifndef __nvdialog_error_h__
29#define __nvdialog_error_h__ 1
30
31#include "nvdialog_platform.h"
32
33/**
34 * @brief An enumerator describing possible errors that may occur from the library.
35 * One of its fields is returned by `nvd_get_error` depending on whether a (and what)
36 * problem might've occured after an operation.
37 * @sa nvd_stringify_error
38 * @since v0.1.0
39 */
54
55/**
56 * @brief Returns the current error code of the library.
57 *
58 * The error code has to be manually be transformed into a string
59 * using @ref nvd_stringify_error. Else, use the @ref NvdError enum to check for
60 * the error manually.
61 *
62 * @ingroup Error
63 * @returns The error code (Will be automatically 0 if no errors were
64 * encountered).
65 */
67
68/**
69 * @brief Transforms an error code into a string representation, that can be
70 * used to print errors to the console.
71 * @returns A @ref NvdDynamicString containing the error as a string, or NULL in case of failure or invalid parameter.
72 * @ingroup Error
73 * @note Pre v0.10 code may not work with this function due to different return types.
74 */
76
77#endif /* __nvdialog_error_h__ */
#define NVD_API
Definition nvdialog.h:113
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:40
@ NVD_NO_DISPLAY
Definition nvdialog_error.h:42
@ NVD_STRING_EMPTY
Definition nvdialog_error.h:48
@ NVD_FILE_INACCESSIBLE
Definition nvdialog_error.h:47
@ NVD_NOT_INITIALIZED
Definition nvdialog_error.h:45
@ NVD_UNSUPPORTED_ACTION
Definition nvdialog_error.h:52
@ NVD_OUT_OF_MEMORY
Definition nvdialog_error.h:49
@ NVD_BACKEND_INVALID
Definition nvdialog_error.h:46
@ NVD_INVALID_PARAM
Definition nvdialog_error.h:44
@ NVD_ALREADY_INITIALIZED
Definition nvdialog_error.h:51
@ NVD_INTERNAL_ERROR
Definition nvdialog_error.h:50
@ NVD_BACKEND_FAILURE
Definition nvdialog_error.h:43
@ NVD_NO_ERROR
Definition nvdialog_error.h:41
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...
struct _NvdDynamicString NvdDynamicString
A string type that can be resized, manipulated, converted and read from.
Definition nvdialog_string.h:60