From 469fefc5ce062515b6b308f72fdf893d4f806f10 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 28 Mar 2016 08:08:43 +0200 Subject: pass parser state as shared ptr --- src/lib/SW602GraphicListener.cpp | 12 ++++++------ src/lib/SW602GraphicListener.h | 6 +++--- src/lib/SW602SpreadsheetListener.cpp | 14 +++++++------- src/lib/SW602SpreadsheetListener.h | 6 +++--- src/lib/SW602TextListener.cpp | 10 +++++----- src/lib/SW602TextListener.h | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/lib/SW602GraphicListener.cpp b/src/lib/SW602GraphicListener.cpp index 7f711a2..8a4930f 100644 --- a/src/lib/SW602GraphicListener.cpp +++ b/src/lib/SW602GraphicListener.cpp @@ -153,13 +153,13 @@ State::State() : m_origin(0,0), } } -SW602GraphicListener::SW602GraphicListener(SW602ParserState &parserState, std::vector const &pageList, librevenge::RVNGDrawingInterface *documentInterface) : SW602Listener(), +SW602GraphicListener::SW602GraphicListener(SW602ParserStatePtr parserState, std::vector const &pageList, librevenge::RVNGDrawingInterface *documentInterface) : SW602Listener(), m_ds(new SW602GraphicListenerInternal::GraphicState(pageList)), m_ps(new SW602GraphicListenerInternal::State), m_psStack(), m_parserState(parserState), m_documentInterface(documentInterface) { } -SW602GraphicListener::SW602GraphicListener(SW602ParserState &parserState, SW602Box2f const &box, librevenge::RVNGDrawingInterface *documentInterface) : SW602Listener(), +SW602GraphicListener::SW602GraphicListener(SW602ParserStatePtr parserState, SW602Box2f const &box, librevenge::RVNGDrawingInterface *documentInterface) : SW602Listener(), m_ds(), m_ps(new SW602GraphicListenerInternal::State), m_psStack(), m_parserState(parserState), m_documentInterface(documentInterface) { SW602PageSpan pageSpan; @@ -201,7 +201,7 @@ void SW602GraphicListener::insertCharacter(unsigned char c) SW602_DEBUG_MSG(("SW602GraphicListener::insertCharacter: called outside a text zone\n")); return; } - const int unicode = m_parserState.m_converter->unicode(c); + const int unicode = m_parserState->m_converter->unicode(c); if (unicode == -1) { if (c < 0x20) @@ -685,7 +685,7 @@ int SW602GraphicListener::_getListId() const SW602_DEBUG_MSG(("SW602GraphicListener::_getListId: the list id is not set, try to find a new one\n")); first = false; } - boost::shared_ptr list=m_parserState.m_listManager->getNewList + boost::shared_ptr list=m_parserState->m_listManager->getNewList (m_ps->m_list, int(newLevel), *m_ps->m_paragraph.m_listLevel); if (!list) return -1; return list->getId(); @@ -719,14 +719,14 @@ void SW602GraphicListener::_changeList() { boost::shared_ptr theList; - theList=m_parserState.m_listManager->getList(newListId); + theList=m_parserState->m_listManager->getList(newListId); if (!theList) { SW602_DEBUG_MSG(("SW602GraphicListener::_changeList: can not find any list\n")); m_ps->m_listOrderedLevels.resize(actualLevel); return; } - m_parserState.m_listManager->needToSend(newListId, m_ds->m_sentListMarkers); + m_parserState->m_listManager->needToSend(newListId, m_ds->m_sentListMarkers); m_ps->m_list = theList; m_ps->m_list->setLevel((int)newLevel); } diff --git a/src/lib/SW602GraphicListener.h b/src/lib/SW602GraphicListener.h index b3c4013..b038654 100644 --- a/src/lib/SW602GraphicListener.h +++ b/src/lib/SW602GraphicListener.h @@ -35,11 +35,11 @@ class SW602GraphicListener : public SW602Listener { public: /** constructor */ - SW602GraphicListener(SW602ParserState &parserState, std::vector const &pageList, librevenge::RVNGDrawingInterface *documentInterface); + SW602GraphicListener(SW602ParserStatePtr parserState, std::vector const &pageList, librevenge::RVNGDrawingInterface *documentInterface); /** simplified constructor (can be used for a embedded graphic with one page). \note the box coordinates must be given in point.*/ - SW602GraphicListener(SW602ParserState &parserState, SW602Box2f const &box, librevenge::RVNGDrawingInterface *documentInterface); + SW602GraphicListener(SW602ParserStatePtr parserState, SW602Box2f const &box, librevenge::RVNGDrawingInterface *documentInterface); /** destructor */ virtual ~SW602GraphicListener(); @@ -262,7 +262,7 @@ protected: //! stack of local state std::vector > m_psStack; //! the parser state - SW602ParserState &m_parserState; + SW602ParserStatePtr m_parserState; //! the document interface librevenge::RVNGDrawingInterface *m_documentInterface; diff --git a/src/lib/SW602SpreadsheetListener.cpp b/src/lib/SW602SpreadsheetListener.cpp index 22a1b75..dcdfac3 100644 --- a/src/lib/SW602SpreadsheetListener.cpp +++ b/src/lib/SW602SpreadsheetListener.cpp @@ -187,13 +187,13 @@ State::State() : } } -SW602SpreadsheetListener::SW602SpreadsheetListener(SW602ParserState &parserState, std::vector const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface) : SW602Listener(), +SW602SpreadsheetListener::SW602SpreadsheetListener(SW602ParserStatePtr parserState, std::vector const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface) : SW602Listener(), m_ds(new SW602SpreadsheetListenerInternal::DocumentState(pageList)), m_ps(new SW602SpreadsheetListenerInternal::State), m_psStack(), m_parserState(parserState), m_documentInterface(documentInterface) { } -SW602SpreadsheetListener::SW602SpreadsheetListener(SW602ParserState &parserState, SW602Box2f const &box, librevenge::RVNGSpreadsheetInterface *documentInterface) : SW602Listener(), +SW602SpreadsheetListener::SW602SpreadsheetListener(SW602ParserStatePtr parserState, SW602Box2f const &box, librevenge::RVNGSpreadsheetInterface *documentInterface) : SW602Listener(), m_ds(), m_ps(new SW602SpreadsheetListenerInternal::State), m_psStack(), m_parserState(parserState), m_documentInterface(documentInterface) { SW602PageSpan pageSpan; @@ -241,7 +241,7 @@ void SW602SpreadsheetListener::insertCharacter(unsigned char c) SW602_DEBUG_MSG(("SW602SpreadsheetListener::insertCharacter: called outside a text zone\n")); return; } - const int unicode = m_parserState.m_converter->unicode(c); + const int unicode = m_parserState->m_converter->unicode(c); if (unicode == -1) { if (c < 0x20) @@ -734,7 +734,7 @@ int SW602SpreadsheetListener::_getListId() const SW602_DEBUG_MSG(("SW602SpreadsheetListener::_getListId: the list id is not set, try to find a new one\n")); first = false; } - boost::shared_ptr list=m_parserState.m_listManager->getNewList + boost::shared_ptr list=m_parserState->m_listManager->getNewList (m_ps->m_list, int(newLevel), *m_ps->m_paragraph.m_listLevel); if (!list) return -1; return list->getId(); @@ -766,14 +766,14 @@ void SW602SpreadsheetListener::_changeList() { boost::shared_ptr theList; - theList=m_parserState.m_listManager->getList(newListId); + theList=m_parserState->m_listManager->getList(newListId); if (!theList) { SW602_DEBUG_MSG(("SW602SpreadsheetListener::_changeList: can not find any list\n")); m_ps->m_listOrderedLevels.resize(actualLevel); return; } - m_parserState.m_listManager->needToSend(newListId, m_ds->m_sentListMarkers); + m_parserState->m_listManager->needToSend(newListId, m_ds->m_sentListMarkers); m_ps->m_list = theList; m_ps->m_list->setLevel((int)newLevel); } @@ -1722,7 +1722,7 @@ void SW602SpreadsheetListener::openSheetCell(SW602Cell const &cell, SW602CellCon { librevenge::RVNGPropertyListVector formulaVect; for (size_t i=0; i < content.m_formula.size(); ++i) - formulaVect.append(content.m_formula[i].getPropertyList(*m_parserState.m_converter)); + formulaVect.append(content.m_formula[i].getPropertyList(*m_parserState->m_converter)); propList.insert("librevenge:formula", formulaVect); } bool hasFormula=!content.m_formula.empty(); diff --git a/src/lib/SW602SpreadsheetListener.h b/src/lib/SW602SpreadsheetListener.h index b559a26..0a0611b 100644 --- a/src/lib/SW602SpreadsheetListener.h +++ b/src/lib/SW602SpreadsheetListener.h @@ -42,11 +42,11 @@ class SW602SpreadsheetListener : public SW602Listener { public: /** constructor */ - SW602SpreadsheetListener(SW602ParserState &parserState, std::vector const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface); + SW602SpreadsheetListener(SW602ParserStatePtr parserState, std::vector const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface); /** simplified constructor (can be used for a embedded spreadsheet with one page). \note the box coordinates must be given in point.*/ - SW602SpreadsheetListener(SW602ParserState &parserState, SW602Box2f const &box, librevenge::RVNGSpreadsheetInterface *documentInterface); + SW602SpreadsheetListener(SW602ParserStatePtr parserState, SW602Box2f const &box, librevenge::RVNGSpreadsheetInterface *documentInterface); /** destructor */ virtual ~SW602SpreadsheetListener(); @@ -266,7 +266,7 @@ protected: //! stack of local state std::vector > m_psStack; //! the parser state - SW602ParserState &m_parserState; + SW602ParserStatePtr m_parserState; //! the document interface librevenge::RVNGSpreadsheetInterface *m_documentInterface; diff --git a/src/lib/SW602TextListener.cpp b/src/lib/SW602TextListener.cpp index 5903fb4..4af4582 100644 --- a/src/lib/SW602TextListener.cpp +++ b/src/lib/SW602TextListener.cpp @@ -179,7 +179,7 @@ State::State() : } } -SW602TextListener::SW602TextListener(SW602ParserState &parserState, std::vector const &pageList, librevenge::RVNGTextInterface *documentInterface) : SW602Listener(), +SW602TextListener::SW602TextListener(SW602ParserStatePtr parserState, std::vector const &pageList, librevenge::RVNGTextInterface *documentInterface) : SW602Listener(), m_ds(new SW602TextListenerInternal::DocumentState(pageList)), m_ps(new SW602TextListenerInternal::State), m_psStack(), m_parserState(parserState), m_documentInterface(documentInterface) { @@ -206,7 +206,7 @@ void SW602TextListener::insertChar(uint8_t character) void SW602TextListener::insertCharacter(unsigned char c) { - const int unicode = m_parserState.m_converter->unicode(c); + const int unicode = m_parserState->m_converter->unicode(c); if (unicode == -1) { if (c < 0x20) @@ -832,7 +832,7 @@ int SW602TextListener::_getListId() const SW602_DEBUG_MSG(("SW602TextListener::_getListId: the list id is not set, try to find a new one\n")); first = false; } - boost::shared_ptr list=m_parserState.m_listManager->getNewList + boost::shared_ptr list=m_parserState->m_listManager->getNewList (m_ps->m_list, int(newLevel), *m_ps->m_paragraph.m_listLevel); if (!list) return -1; return list->getId(); @@ -866,14 +866,14 @@ void SW602TextListener::_changeList() { boost::shared_ptr theList; - theList=m_parserState.m_listManager->getList(newListId); + theList=m_parserState->m_listManager->getList(newListId); if (!theList) { SW602_DEBUG_MSG(("SW602TextListener::_changeList: can not find any list\n")); m_ps->m_listOrderedLevels.resize(actualLevel); return; } - m_parserState.m_listManager->needToSend(newListId, m_ds->m_sentListMarkers); + m_parserState->m_listManager->needToSend(newListId, m_ds->m_sentListMarkers); m_ps->m_list = theList; m_ps->m_list->setLevel((int)newLevel); } diff --git a/src/lib/SW602TextListener.h b/src/lib/SW602TextListener.h index 8f00ab5..57ad36c 100644 --- a/src/lib/SW602TextListener.h +++ b/src/lib/SW602TextListener.h @@ -41,7 +41,7 @@ class SW602TextListener : public SW602Listener { public: /** constructor */ - SW602TextListener(SW602ParserState &parserState, std::vector const &pageList, librevenge::RVNGTextInterface *documentInterface); + SW602TextListener(SW602ParserStatePtr parserState, std::vector const &pageList, librevenge::RVNGTextInterface *documentInterface); /** destructor */ virtual ~SW602TextListener(); @@ -244,7 +244,7 @@ protected: //! stack of local state std::vector > m_psStack; //! the parser state - SW602ParserState &m_parserState; + SW602ParserStatePtr m_parserState; //! the document interface librevenge::RVNGTextInterface *m_documentInterface; -- cgit v1.2.3