File: parseerror.cpp

package info (click to toggle)
martchus-cpp-utilities 5.28.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,352 kB
  • sloc: cpp: 12,471; awk: 18; ansic: 12; makefile: 10
file content (34 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "./parseerror.h"

#include "../io/ansiescapecodes.h"

#include <iostream>

namespace CppUtilities {

/*!
 * \class ParseError
 * \brief The ParseError class is thrown by an ArgumentParser when a parsing error occurs.
 * \remarks The class might be used in other parsers, too.
 * \sa ArgumentParser
 */

/*!
 * \brief Destroys the ParseError.
 */
ParseError::~ParseError() noexcept
{
}

/*!
 * \brief Prints an error message "Unable to parse arguments: ..." for the specified \a failure.
 */
std::ostream &operator<<(std::ostream &o, const ParseError &failure)
{
    using namespace std;
    using namespace EscapeCodes;
    return o << Phrases::Error << "Unable to parse arguments: " << TextAttribute::Reset << failure.what() << "\nSee --help for available commands."
             << endl;
}

} // namespace CppUtilities