CommonParser.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 libcdr 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 __COMMONPARSER_H__
00011 #define __COMMONPARSER_H__
00012 
00013 #include "CDRCollector.h"
00014 #include "CDRPath.h"
00015 
00016 namespace libcdr
00017 {
00018 
00019 enum CoordinatePrecision
00020 { PRECISION_UNKNOWN = 0, PRECISION_16BIT, PRECISION_32BIT };
00021 
00022 class CommonParser
00023 {
00024 public:
00025   CommonParser(CDRCollector *collector);
00026   virtual ~CommonParser();
00027 
00028 private:
00029   CommonParser();
00030   CommonParser(const CommonParser &);
00031   CommonParser &operator=(const CommonParser &);
00032 
00033 
00034 protected:
00035   double readRectCoord(librevenge::RVNGInputStream *input, bool bigEndian = false);
00036   double readCoordinate(librevenge::RVNGInputStream *input, bool bigEndian = false);
00037   unsigned readUnsigned(librevenge::RVNGInputStream *input, bool bigEndian = false);
00038   unsigned short readUnsignedShort(librevenge::RVNGInputStream *input, bool bigEndian = false);
00039   int readInteger(librevenge::RVNGInputStream *input, bool bigEndian = false);
00040   double readAngle(librevenge::RVNGInputStream *input, bool bigEndian = false);
00041 
00042   void processPath(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned char> &types, CDRPath &path);
00043   void outputPath(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned char> &types);
00044 
00045   CDRCollector *m_collector;
00046   CoordinatePrecision m_precision;
00047 };
00048 } // namespace libcdr
00049 
00050 #endif // __COMMONPARSER_H__
00051 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */