summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2016-02-25 14:40:20 +0100
committerDavid Tardon <dtardon@redhat.com>2016-02-25 14:40:20 +0100
commit34d8f4fd336130c694a9d4a44e98d994c488c3c9 (patch)
tree23a651e545dc31721d919a1bcfa458785f22f523
parent9ed1791be476b8568ebe1878ff693c06c5d70006 (diff)
start moving to SW602Parser
-rw-r--r--src/lib/Software602Document.cpp5
-rw-r--r--src/lib/WinText602Parser.cpp13
-rw-r--r--src/lib/WinText602Parser.h14
3 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/Software602Document.cpp b/src/lib/Software602Document.cpp
index 4750b5d..9019b4c 100644
--- a/src/lib/Software602Document.cpp
+++ b/src/lib/Software602Document.cpp
@@ -108,8 +108,9 @@ Software602Document::Result Software602Document::parse(librevenge::RVNGInputStre
if (bool(content))
{
content->seek(0, librevenge::RVNG_SEEK_SET);
- WinText602Parser parser(content, document);
- return parser.parse() ? RESULT_OK : RESULT_PARSE_ERROR;
+ WinText602Parser parser(content);
+ parser.parse(document);
+ return RESULT_OK;
}
break;
}
diff --git a/src/lib/WinText602Parser.cpp b/src/lib/WinText602Parser.cpp
index b0a29fa..96d371b 100644
--- a/src/lib/WinText602Parser.cpp
+++ b/src/lib/WinText602Parser.cpp
@@ -109,16 +109,19 @@ shared_ptr<RVNGInputStream> WinText602SectionMap::getSectionStream(librevenge::R
namespace libsw602
{
-WinText602Parser::WinText602Parser(const boost::shared_ptr<librevenge::RVNGInputStream> input, librevenge::RVNGTextInterface *const document)
- : m_header(*input)
+WinText602Parser::WinText602Parser(const boost::shared_ptr<librevenge::RVNGInputStream> input)
+ : SW602TextParser(input)
+ , m_header(*input)
, m_input(input)
- , m_document(document)
+ , m_document(0)
, m_sectionMap()
{
}
-bool WinText602Parser::parse()
+void WinText602Parser::parse(librevenge::RVNGTextInterface *documentInterface)
{
+ m_document = documentInterface;
+
m_sectionMap.reset(new WinText602SectionMap(*m_input));
m_document->startDocument(librevenge::RVNGPropertyList());
@@ -129,7 +132,7 @@ bool WinText602Parser::parse()
m_document->closePageSpan();
m_document->endDocument();
- return true;
+ m_document = 0;
}
void WinText602Parser::readText()
diff --git a/src/lib/WinText602Parser.h b/src/lib/WinText602Parser.h
index dee476c..0d69a87 100644
--- a/src/lib/WinText602Parser.h
+++ b/src/lib/WinText602Parser.h
@@ -10,11 +10,7 @@
#ifndef INCLUDED_WINTEXT602PARSER_H
#define INCLUDED_WINTEXT602PARSER_H
-#include <boost/shared_ptr.hpp>
-
-#include <librevenge/librevenge.h>
-
-#include "libsw602_utils.h"
+#include "SW602Parser.h"
#include "WinText602Header.h"
namespace libsw602
@@ -63,16 +59,16 @@ enum WinText602Section
class WinText602SectionMap;
-class WinText602Parser
+class WinText602Parser : public SW602TextParser
{
- // -Weffc++
+ // disable copying
WinText602Parser(const WinText602Parser &other);
WinText602Parser &operator=(const WinText602Parser &other);
public:
- WinText602Parser(boost::shared_ptr<librevenge::RVNGInputStream> input, librevenge::RVNGTextInterface *document);
+ explicit WinText602Parser(boost::shared_ptr<librevenge::RVNGInputStream> input);
- bool parse();
+ virtual void parse(librevenge::RVNGTextInterface *documentInterface);
private:
void readText();