GDCM: gdcmParseException.h Source File

GDCM 3.0.25

gdcmParseException.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14#ifndef GDCMPARSEEXCEPTION_H
15#define GDCMPARSEEXCEPTION_H
16
17#include "gdcmException.h"
18#include "gdcmDataElement.h"
19
20// Disable clang warning "dynamic exception specifications are deprecated".
21// We need to be C++03 and C++11 compatible, and if we remove the 'throw()'
22// specifier we'll get an error in C++03 by not matching the superclass.
23#if defined(__clang__) && defined(__has_warning)
24# if __has_warning("-Wdeprecated")
25# pragma clang diagnostic push
26# pragma clang diagnostic ignored "-Wdeprecated"
27# endif
28#endif
29
30namespace gdcm_ns
31{
36 class ParseException : public Exception
37{
38public:
39 ParseException() = default;
40 ~ParseException() throw() override {}
41
43 ParseException &operator= ( const ParseException &orig )
44 {
45 LastElement = orig.LastElement;
46 return *this;
47 }
48 ParseException(const ParseException& orig):Exception(orig)
49 {
50 LastElement = orig.LastElement;
51 }
52
54/* virtual bool operator==( const ParseException &orig )
55 {
56 return true;
57 }*/
58
59/*
60 // Multiple calls to what ??
61 const char* what() const throw()
62 {
63 static std::string strwhat;
64 std::ostringstream oswhat;
65 oswhat << File << ":" << Line << ":\n";
66 oswhat << Description;
67 strwhat = oswhat.str();
68 return strwhat.c_str();
69 }
70*/
71 void SetLastElement(DataElement& de)
72 {
73 LastElement = de;
74 }
75 const DataElement& GetLastElement() const { return LastElement; }
76
77private:
78 // Store last parsed element before error:
79 DataElement LastElement;
80};
81
82} // end namespace gdcm_ns
83
84// Undo warning suppression.
85#if defined(__clang__) && defined(__has_warning)
86# if __has_warning("-Wdeprecated")
87# pragma clang diagnostic pop
88# endif
89#endif
90
91#endif
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::Exception::Exception
Exception(const char *desc="None", const char *file=__FILE__, unsigned int lineNumber=__LINE__, const char *func="")
Definition gdcmException.h:72
gdcm::ParseException::GetLastElement
const DataElement & GetLastElement() const
Definition gdcmParseException.h:75
gdcm::ParseException::SetLastElement
void SetLastElement(DataElement &de)
Definition gdcmParseException.h:71
gdcm::ParseException::~ParseException
~ParseException() override
Definition gdcmParseException.h:40
gdcm::ParseException::ParseException
ParseException()=default
gdcm::ParseException::ParseException
ParseException(const ParseException &orig)
Definition gdcmParseException.h:48
gdcmDataElement.h
gdcmException.h