exception.h Source File

NEDXML API: exception.h Source File
NEDXML API
exception.h
1//==========================================================================
2// exception.h -
3//
4// OMNeT++/OMNEST
5// Discrete System Simulation in C++
6//
7//==========================================================================
8
9/*--------------------------------------------------------------*
10 Copyright (C) 2002-2017 Andras Varga
11 Copyright (C) 2006-2017 OpenSim Ltd.
12
13 This file is distributed WITHOUT ANY WARRANTY. See the file
14 `license' for details on this and other legal matters.
15*--------------------------------------------------------------*/
16
17#ifndef __OMNETPP_NEDXML_EXCEPTION_H
18#define __OMNETPP_NEDXML_EXCEPTION_H
19
20#include <string>
21#include <exception>
22#include <stdexcept>
23#include "nedxmldefs.h"
24
25namespace omnetpp {
26namespace nedxml {
27
28class ASTNode;
29
33class NEDXML_API NedException : public std::runtime_error
34{
35 protected:
36 std::string msg;
37
38 public:
42 _OPP_GNU_ATTRIBUTE(format(printf, 2, 3))
43 NedException(const char *messagefmt,...);
44
48 _OPP_GNU_ATTRIBUTE(format(printf, 3, 4))
49 NedException(ASTNode *context, const char *messagefmt,...);
50
54 virtual ~NedException() throw() {}
55
59 virtual const char *what() const throw() override {return msg.c_str();}
60};
61
62
63} // namespace nedxml
64} // namespace omnetpp
65
66
67#endif
68
Definition astnode.h:88
virtual const char * what() const override
Definition exception.h:59
NedException(const char *messagefmt,...)