args-parser
6.3.6
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
2
/*
3
SPDX-FileCopyrightText: 2026 Igor Mironchik <igor.mironchik@gmail.com>
4
SPDX-License-Identifier: MIT
5
*/
6
7
#ifndef ARGS__EXCEPTIONS_HPP__INCLUDED
8
#define ARGS__EXCEPTIONS_HPP__INCLUDED
9
10
// C++ include.
11
#include <stdexcept>
12
13
// Args include.
14
#include "
types.hpp
"
15
16
namespace
Args
17
{
18
19
//
20
// BaseException
21
//
22
24
class
BaseException
:
public
std::logic_error
25
{
26
public
:
27
explicit
BaseException
(
String
what)
28
: std::logic_error(
"Please use desc() method of the exception."
)
29
, m_what(std::move(what))
30
{
31
}
32
33
virtual
~BaseException
() noexcept
34
{
35
}
36
38
const
String
&
desc
() const noexcept
39
{
40
return
m_what;
41
}
42
43
private
:
45
String
m_what;
46
};
// class BaseException
47
48
//
49
// HelpHasBeenPrintedException
50
//
51
53
class
HelpHasBeenPrintedException
final :
public
BaseException
54
{
55
public
:
56
HelpHasBeenPrintedException
()
57
:
BaseException
(
SL
(
"Help has been printed."
))
58
{
59
}
60
};
// class HelpHasBeenPrintedException
61
62
}
/* namespace Args */
63
64
#endif
// ARGS__EXCEPTIONS_HPP__INCLUDED
Args::BaseException::~BaseException
virtual ~BaseException() noexcept
Definition
exceptions.hpp:33
Args::BaseException::desc
const String & desc() const noexcept
Definition
exceptions.hpp:38
Args::BaseException::BaseException
BaseException(String what)
Definition
exceptions.hpp:27
Args::HelpHasBeenPrintedException::HelpHasBeenPrintedException
HelpHasBeenPrintedException()
Definition
exceptions.hpp:56
Args
Definition
api.hpp:18
Args::String
std::string String
String type.
Definition
types.hpp:314
types.hpp
SL
#define SL(str)
Definition
types.hpp:328
args-parser
exceptions.hpp
Generated by
1.16.1