PMDRecord.h Source File documentation

PMDRecord.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 __PMDRECORD_H__
11#define __PMDRECORD_H__
12
13#include <stdint.h>
14#include <vector>
15
16#include <boost/optional.hpp>
17
18#include <librevenge/librevenge.h>
19
20#include "constants.h"
21
22namespace libpagemaker
23{
24
25 struct PMDRecordContainer
26{
27 uint16_t m_recordType;
28 uint32_t m_offset;
29 unsigned m_seqNum;
30 uint16_t m_numRecords;
31
32 PMDRecordContainer(uint16_t recordType, uint32_t offset, unsigned seqNum, uint16_t numRecords)
33 : m_recordType(recordType), m_offset(offset), m_seqNum(seqNum),
34 m_numRecords(numRecords)
35 { }
36};
37
38 inline boost::optional<unsigned> getRecordSize(uint16_t recType)
39{
40 switch (recType)
41 {
42 case SHAPE:
43 return 258;
44 case GLOBAL_INFO:
45 return 2496;
46 case PAGE:
47 return 472;
48 case LINE_SET:
49 return 4;
50 case XFORM:
51 return 26;
52 case TEXT_BLOCK:
53 return 36;
54 case CHARS:
55 return 30;
56 case PARA:
57 return 80;
58 case FONTS:
59 return 94;
60 case FONTS_PARENT:
61 return 10;
62 case COLORS:
63 return 210;
64 default:
65 return boost::none;
66 }
67}
68
69}
70
71#endif /* __PMDRECORD_H__ */
72
73/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
constants.h
FONTS
const uint8_t FONTS
Definition: constants.h:21
LINE_SET
const uint8_t LINE_SET
Definition: constants.h:20
FONTS_PARENT
const uint8_t FONTS_PARENT
Definition: constants.h:16
XFORM
const uint8_t XFORM
Definition: constants.h:27
PAGE
const uint8_t PAGE
Definition: constants.h:17
PARA
const uint8_t PARA
Definition: constants.h:18
CHARS
const uint8_t CHARS
Definition: constants.h:26
TEXT_BLOCK
const uint8_t TEXT_BLOCK
Definition: constants.h:25
GLOBAL_INFO
const uint8_t GLOBAL_INFO
Definition: constants.h:23
SHAPE
const uint8_t SHAPE
Definition: constants.h:24
COLORS
const uint8_t COLORS
Definition: constants.h:22
libpagemaker
Definition: geometry.h:23
libpagemaker::getRecordSize
boost::optional< unsigned > getRecordSize(uint16_t recType)
Definition: PMDRecord.h:38
libpagemaker::PMDRecordContainer
Definition: PMDRecord.h:26
libpagemaker::PMDRecordContainer::m_offset
uint32_t m_offset
Definition: PMDRecord.h:28
libpagemaker::PMDRecordContainer::m_seqNum
unsigned m_seqNum
Definition: PMDRecord.h:29
libpagemaker::PMDRecordContainer::PMDRecordContainer
PMDRecordContainer(uint16_t recordType, uint32_t offset, unsigned seqNum, uint16_t numRecords)
Definition: PMDRecord.h:32
libpagemaker::PMDRecordContainer::m_recordType
uint16_t m_recordType
Definition: PMDRecord.h:27
libpagemaker::PMDRecordContainer::m_numRecords
uint16_t m_numRecords
Definition: PMDRecord.h:30