WPSTextParser.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwps
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwps.sourceforge.net
*/
#ifndef WPS_TEXT_PARSER_H
#define WPS_TEXT_PARSER_H
#include <vector>
#include "libwps_internal.h"
#include "WPSDebug.h"
#include "WPSEntry.h"
class WPSParser;
class WPSTextParser
{
public:
virtual ~WPSTextParser();
int version() const;
WPXInputStreamPtr &getInput()
{
return m_input;
}
protected:
WPSTextParser(WPSParser &parser, WPXInputStreamPtr &input);
std::multimap<std::string, WPSEntry> &getNameEntryMap();
std::multimap<std::string, WPSEntry> const &getNameEntryMap() const;
protected:
struct DataFOD
{
enum Type { ATTR_TEXT, ATTR_PARAG, ATTR_PLC, ATTR_UNKN };
DataFOD() : m_type(ATTR_UNKN), m_pos(-1), m_defPos(0), m_id(-1) {}
Type m_type;
long m_pos;
long m_defPos;
int m_id;
};
std::vector<DataFOD> mergeSortedFODLists
(std::vector<DataFOD> const &lst1, std::vector<DataFOD> const &lst2) const;
typedef bool (WPSTextParser::* FDPParser) (long endPos,
int &id, std::string &mess);
bool readFDP(WPSEntry const &entry,
std::vector<DataFOD> &fods, FDPParser parser);
protected:
libwps::DebugFile &ascii()
{
return m_asciiFile;
}
private:
WPSTextParser(WPSTextParser const &parser );
WPSTextParser &operator=(WPSTextParser const &parser);
protected:
mutable int m_version;
WPXInputStreamPtr m_input;
WPSParser &m_mainParser;
WPSEntry m_textPositions;
std::vector<DataFOD> m_FODList;
libwps::DebugFile &m_asciiFile;
};
#endif /* WPSTEXTPARSER_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */