PMDExceptions.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
19 struct PMDParseException
20 {
21 std::string m_message;
22 PMDParseException(const std::string &message)
23 : m_message(message)
24 { }
25 virtual ~PMDParseException() { }
26 };
27
28 struct RecordNotFoundException : public PMDParseException
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
43 struct CorruptRecordException : public PMDParseException
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
53 struct EmptyLineSetException
54 {
55 };
56
57 struct UnknownRecordSizeException : public PMDParseException
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: */
libpagemaker::PMDParseException::PMDParseException
PMDParseException(const std::string &message)
Definition: PMDExceptions.h:22
libpagemaker::RecordNotFoundException::m_recordType
uint16_t m_recordType
Definition: PMDExceptions.h:30
libpagemaker::PMDParseException::m_message
std::string m_message
Definition: PMDExceptions.h:21
libpagemaker::RecordNotFoundException::RecordNotFoundException
RecordNotFoundException(uint16_t recordType, uint16_t seqNum)
Definition: PMDExceptions.h:37
libpagemaker::RecordNotFoundException::RecordNotFoundException
RecordNotFoundException(uint16_t recordType)
Definition: PMDExceptions.h:32
libpagemaker::UnknownRecordSizeException::UnknownRecordSizeException
UnknownRecordSizeException(uint16_t recordType)
Definition: PMDExceptions.h:61
libpagemaker::RecordNotFoundException
Definition: PMDExceptions.h:28
libpagemaker::UnknownRecordSizeException::m_recordType
uint16_t m_recordType
Definition: PMDExceptions.h:59
libpagemaker::EmptyLineSetException
Definition: PMDExceptions.h:53
libpagemaker::CorruptRecordException
Definition: PMDExceptions.h:43
libpagemaker::PMDParseException
Definition: PMDExceptions.h:19
libpagemaker::CorruptRecordException::m_recordType
uint16_t m_recordType
Definition: PMDExceptions.h:45
libpagemaker::PMDParseException::~PMDParseException
virtual ~PMDParseException()
Definition: PMDExceptions.h:25
libpagemaker
Definition: geometry.h:20
libpagemaker::UnknownRecordSizeException
Definition: PMDExceptions.h:57
libpagemaker::CorruptRecordException::CorruptRecordException
CorruptRecordException(uint16_t recordType, const std::string &message)
Definition: PMDExceptions.h:47