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 
15 #include <boost/format.hpp>
16 
17 #include <librevenge/librevenge.h>
18 
19 namespace libpagemaker
20 {
21 
23 {
24  std::string m_message;
25  PMDParseException(const std::string &message)
26  : m_message(message)
27  { }
28  virtual ~PMDParseException() { }
29 };
30 
32 {
33  uint16_t m_recordType;
34 
35  RecordNotFoundException(uint16_t recordType)
36  : PMDParseException((boost::format("Record not found: %d") % recordType).str()),
37  m_recordType(recordType)
38  { }
39 
40  RecordNotFoundException(uint16_t recordType, uint16_t seqNum)
41  : PMDParseException((boost::format("Record of type %d not found at seqNum %d") % recordType % seqNum).str()),
42  m_recordType(recordType)
43  { }
44 };
45 
47 {
48  uint16_t m_recordType;
49 
50  CorruptRecordException(uint16_t recordType, const std::string &message)
51  : PMDParseException((boost::format("Corrupt record: %d\nError message: %s\n") % recordType % message).str()),
52  m_recordType(recordType)
53  { }
54 };
55 
57 {
58 };
59 
61 {
62  uint16_t m_recordType;
63 
64  UnknownRecordSizeException(uint16_t recordType)
65  : PMDParseException((boost::format("Tried to parse record %d of unknown size.\n") % recordType).str()),
66  m_recordType(recordType)
67  { }
68 };
69 
70 }
71 
72 #endif /* __PMDEXCEPTIONS_H__ */
73 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libpagemaker::RecordNotFoundException::m_recordType
uint16_t m_recordType
Definition: PMDExceptions.h:33
libpagemaker::PMDParseException::PMDParseException
PMDParseException(const std::string &message)
Definition: PMDExceptions.h:25
libpagemaker::UnknownRecordSizeException::UnknownRecordSizeException
UnknownRecordSizeException(uint16_t recordType)
Definition: PMDExceptions.h:64
libpagemaker::PMDParseException::~PMDParseException
virtual ~PMDParseException()
Definition: PMDExceptions.h:28
libpagemaker::EmptyLineSetException
Definition: PMDExceptions.h:56
libpagemaker::PMDParseException
Definition: PMDExceptions.h:22
libpagemaker::PMDParseException::m_message
std::string m_message
Definition: PMDExceptions.h:24
libpagemaker::RecordNotFoundException::RecordNotFoundException
RecordNotFoundException(uint16_t recordType, uint16_t seqNum)
Definition: PMDExceptions.h:40
libpagemaker
Definition: geometry.h:22
libpagemaker::RecordNotFoundException::RecordNotFoundException
RecordNotFoundException(uint16_t recordType)
Definition: PMDExceptions.h:35
libpagemaker::RecordNotFoundException
Definition: PMDExceptions.h:31
libpagemaker::UnknownRecordSizeException::m_recordType
uint16_t m_recordType
Definition: PMDExceptions.h:62
libpagemaker::CorruptRecordException::CorruptRecordException
CorruptRecordException(uint16_t recordType, const std::string &message)
Definition: PMDExceptions.h:50
libpagemaker::CorruptRecordException
Definition: PMDExceptions.h:46
libpagemaker::CorruptRecordException::m_recordType
uint16_t m_recordType
Definition: PMDExceptions.h:48
libpagemaker::UnknownRecordSizeException
Definition: PMDExceptions.h:60

Generated for libpagemaker by doxygen 1.8.16