PMDExceptions.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libpagemaker project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef __PMDEXCEPTIONS_H__
11 #define __PMDEXCEPTIONS_H__
12 
13 #include <stdint.h>
14 #include <librevenge/librevenge.h>
15 #include <boost/format.hpp>
16 namespace libpagemaker
17 {
18 
20 {
21  std::string m_message;
22  PMDParseException(const std::string &message)
23  : m_message(message)
24  { }
25  virtual ~PMDParseException() { }
26 };
27 
29 {
30  uint16_t m_recordType;
31 
32  RecordNotFoundException(uint16_t recordType)
33  : PMDParseException((boost::format("Record not found: %d") % recordType).str()),
34  m_recordType(recordType)
35  { }
36 
37  RecordNotFoundException(uint16_t recordType, uint16_t seqNum)
38  : PMDParseException((boost::format("Record of type %d not found at seqNum %d") % recordType % seqNum).str()),
39  m_recordType(recordType)
40  { }
41 };
42 
44 {
45  uint16_t m_recordType;
46 
47  CorruptRecordException(uint16_t recordType, const std::string &message)
48  : PMDParseException((boost::format("Corrupt record: %d\nError message: %s\n") % recordType % message).str()),
49  m_recordType(recordType)
50  { }
51 };
52 
54 {
55 };
56 
58 {
59  uint16_t m_recordType;
60 
61  UnknownRecordSizeException(uint16_t recordType)
62  : PMDParseException((boost::format("Tried to parse record %d of unknown size.\n") % recordType).str()),
63  m_recordType(recordType)
64  { }
65 };
66 
67 }
68 
69 #endif /* __PMDEXCEPTIONS_H__ */
70 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
PMDParseException(const std::string &message)
Definition: PMDExceptions.h:22
uint16_t m_recordType
Definition: PMDExceptions.h:30
std::string m_message
Definition: PMDExceptions.h:21
RecordNotFoundException(uint16_t recordType, uint16_t seqNum)
Definition: PMDExceptions.h:37
RecordNotFoundException(uint16_t recordType)
Definition: PMDExceptions.h:32
UnknownRecordSizeException(uint16_t recordType)
Definition: PMDExceptions.h:61
Definition: PMDExceptions.h:28
uint16_t m_recordType
Definition: PMDExceptions.h:59
Definition: PMDExceptions.h:53
Definition: PMDExceptions.h:43
Definition: PMDExceptions.h:19
uint16_t m_recordType
Definition: PMDExceptions.h:45
virtual ~PMDParseException()
Definition: PMDExceptions.h:25
Definition: geometry.h:20
Definition: PMDExceptions.h:57
CorruptRecordException(uint16_t recordType, const std::string &message)
Definition: PMDExceptions.h:47

Generated for libpagemaker by doxygen 1.8.10