OMNeT++ NEDXML  6.0.3
exception.h
Go to the documentation of this file.
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 
25 namespace omnetpp {
26 namespace nedxml {
27 
28 class ASTNode;
29 
33 class 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 
omnetpp::nedxml::NedException::msg
std::string msg
Definition: exception.h:36
NEDXML_API
#define NEDXML_API
Definition: nedxmldefs.h:31
omnetpp
Definition: astbuilder.h:25
omnetpp::nedxml::ASTNode
Definition: astnode.h:87
nedxmldefs.h
omnetpp::nedxml::NedException::what
virtual const char * what() const override
Definition: exception.h:59
omnetpp::nedxml::NedException
Low-level routines throw an exception instead of calling NedErrorStore->add().
Definition: exception.h:33