WPSParser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwps
00003  * Version: MPL 2.0 / LGPLv2.1+
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  * Major Contributor(s):
00010  * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
00011  * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
00012  *
00013  * For minor contributions see the git repository.
00014  *
00015  * Alternatively, the contents of this file may be used under the terms
00016  * of the GNU Lesser General Public License Version 2.1 or later
00017  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00018  * applicable instead of those above.
00019  *
00020  * For further information visit http://libwps.sourceforge.net
00021  */
00022 
00023 #ifndef WPSPARSER_H
00024 #define WPSPARSER_H
00025 
00026 #include <map>
00027 #include <string>
00028 
00029 #include "libwps_internal.h"
00030 
00031 #include "WPSDebug.h"
00032 
00033 class WPSTextParser;
00034 
00035 class WPSParser
00036 {
00037         friend class WPSTextParser;
00038 public:
00040         typedef std::multimap<std::string, WPSEntry> NameMultiMap;
00041 
00042         WPSParser(RVNGInputStreamPtr &input, WPSHeaderPtr &header);
00043         virtual ~WPSParser();
00044         virtual void parse(librevenge::RVNGTextInterface *documentInterface) = 0;
00045 
00046 protected:
00047         RVNGInputStreamPtr &getInput()
00048         {
00049                 return m_input;
00050         }
00051         RVNGInputStreamPtr getFileInput();
00052         WPSHeaderPtr &getHeader()
00053         {
00054                 return m_header;
00055         }
00056         int version() const
00057         {
00058                 return m_version;
00059         }
00060         void setVersion(int vers)
00061         {
00062                 m_version=vers;
00063         }
00065         libwps::DebugFile &ascii()
00066         {
00067                 return m_asciiFile;
00068         }
00069 
00070         NameMultiMap &getNameEntryMap()
00071         {
00072                 return m_nameMultiMap;
00073         }
00074         NameMultiMap const &getNameEntryMap() const
00075         {
00076                 return m_nameMultiMap;
00077         }
00078 
00079 private:
00080         WPSParser(const WPSParser &);
00081         WPSParser &operator=(const WPSParser &);
00082 
00083         // the main input
00084         RVNGInputStreamPtr m_input;
00085         // the header
00086         WPSHeaderPtr m_header;
00087         // the file version
00088         int m_version;
00090         libwps::DebugFile m_asciiFile;
00091 
00093         NameMultiMap m_nameMultiMap;
00094 };
00095 
00096 #endif /* WPSPARSER_H */
00097 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */