PMDRecord.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libpagemaker project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __PMDRECORD_H__
00011 #define __PMDRECORD_H__
00012 
00013 #include <stdint.h>
00014 #include <librevenge/librevenge.h>
00015 #include <boost/optional.hpp>
00016 #include <vector>
00017 
00018 #include "constants.h"
00019 
00020 namespace libpagemaker
00021 {
00022 
00023 struct PMDRecordContainer
00024 {
00025   uint16_t m_recordType;
00026   uint32_t m_offset;
00027   unsigned m_seqNum;
00028   uint16_t m_numRecords;
00029 
00030   PMDRecordContainer(uint16_t recordType, uint32_t offset, unsigned seqNum, uint16_t numRecords)
00031     : m_recordType(recordType), m_offset(offset), m_seqNum(seqNum),
00032       m_numRecords(numRecords)
00033   { }
00034 };
00035 
00036 inline boost::optional<unsigned> getRecordSize(uint16_t recType)
00037 {
00038   switch (recType)
00039   {
00040   case SHAPE:
00041     return 258;
00042   case GLOBAL_INFO:
00043     return 2496;
00044   case PAGE:
00045     return 472;
00046   case LINE_SET:
00047     return 4;
00048   case XFORM:
00049     return 26;
00050   case TEXT_BLOCK:
00051     return 36;
00052   case CHARS:
00053     return 30;
00054   case PARA:
00055     return 80;
00056   case FONTS:
00057     return 94;
00058   case FONTS_PARENT:
00059     return 10;
00060   case COLORS:
00061     return 210;
00062   default:
00063     return boost::none;
00064   }
00065 }
00066 
00067 }
00068 
00069 #endif /* __PMDRECORD_H__ */
00070 
00071 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */