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
19namespace 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: */
Definition geometry.h:23
Definition PMDExceptions.h:47
CorruptRecordException(uint16_t recordType, const std::string &message)
Definition PMDExceptions.h:50
uint16_t m_recordType
Definition PMDExceptions.h:48
Definition PMDExceptions.h:57
Definition PMDExceptions.h:23
std::string m_message
Definition PMDExceptions.h:24
PMDParseException(const std::string &message)
Definition PMDExceptions.h:25
virtual ~PMDParseException()
Definition PMDExceptions.h:28
Definition PMDExceptions.h:32
RecordNotFoundException(uint16_t recordType, uint16_t seqNum)
Definition PMDExceptions.h:40
RecordNotFoundException(uint16_t recordType)
Definition PMDExceptions.h:35
uint16_t m_recordType
Definition PMDExceptions.h:33
Definition PMDExceptions.h:61
uint16_t m_recordType
Definition PMDExceptions.h:62
UnknownRecordSizeException(uint16_t recordType)
Definition PMDExceptions.h:64

Generated for libpagemaker by doxygen 1.9.8