Kaydet (Commit) a0dc0d3c authored tarafından Michael Stahl's avatar Michael Stahl

sw: enable some SwNumberTree sanity testing code

__SW_NUMBER_TREE_SANITY_CHECK isn't defined anywhere.

Change-Id: Ieb8c47d12c47a8a1ffcad0616382e4d2b55024a0
üst 4a932d3b
...@@ -337,7 +337,7 @@ public: ...@@ -337,7 +337,7 @@ public:
*/ */
const SwNumberTreeNode* GetPrecedingNodeOf( const SwNumberTreeNode& rNode ) const; const SwNumberTreeNode* GetPrecedingNodeOf( const SwNumberTreeNode& rNode ) const;
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
/** /**
Sanity check. Sanity check.
...@@ -347,7 +347,7 @@ public: ...@@ -347,7 +347,7 @@ public:
@retval false else @retval false else
*/ */
bool IsSane(bool bRecursive) const; bool IsSane(bool bRecursive) const;
#endif // __SW_NUMBER_TREE_SANITY_CHECK #endif // DBG_UTIL
protected: protected:
/** /**
...@@ -390,7 +390,7 @@ protected: ...@@ -390,7 +390,7 @@ protected:
// method called after this tree node has been removed from the list tree // method called after this tree node has been removed from the list tree
virtual void PostRemove() = 0; virtual void PostRemove() = 0;
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
/** /**
Sanity check with loop detection. Sanity check with loop detection.
...@@ -401,7 +401,7 @@ protected: ...@@ -401,7 +401,7 @@ protected:
@retval false else */ @retval false else */
virtual bool IsSane virtual bool IsSane
(bool bRecursive, std::vector<const SwNumberTreeNode *> rParents) const; (bool bRecursive, std::vector<const SwNumberTreeNode *> rParents) const;
#endif // __SW_NUMBER_TREE_SANITY_CHECK #endif // DBG_UTIL
/** /**
the parent node the parent node
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <functional> #include <functional>
#include <SwNumberTree.hxx> #include <SwNumberTree.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <sal/log.hxx>
using std::vector; using std::vector;
using std::find; using std::find;
...@@ -383,9 +384,8 @@ void SwNumberTreeNode::MoveGreaterChildren( SwNumberTreeNode& _rCompareNode, ...@@ -383,9 +384,8 @@ void SwNumberTreeNode::MoveGreaterChildren( SwNumberTreeNode& _rCompareNode,
} }
} }
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
if (! IsSane(false) || ! IsSane(&_rDestNode)) SAL_WARN_IF(!IsSane(false) || !_rDestNode.IsSane(true), "sw.core", "insanity");
clog << __FUNCTION__ << "insanity!" << endl;
#endif #endif
} }
...@@ -432,7 +432,7 @@ void SwNumberTreeNode::MoveChildren(SwNumberTreeNode * pDest) ...@@ -432,7 +432,7 @@ void SwNumberTreeNode::MoveChildren(SwNumberTreeNode * pDest)
OSL_ENSURE(mChildren.empty(), "MoveChildren failed!"); OSL_ENSURE(mChildren.empty(), "MoveChildren failed!");
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
OSL_ENSURE(IsSane(false) && pDest->IsSane(false), "insanity!"); OSL_ENSURE(IsSane(false) && pDest->IsSane(false), "insanity!");
#endif #endif
} }
...@@ -584,9 +584,8 @@ void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild, ...@@ -584,9 +584,8 @@ void SwNumberTreeNode::AddChild( SwNumberTreeNode * pChild,
} }
} }
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
if (! IsSane(false)) SAL_WARN_IF(!IsSane(false), "sw.core", "insanity");
clog << __FUNCTION__ << ": insanity!" << endl;
#endif #endif
} }
...@@ -678,9 +677,8 @@ void SwNumberTreeNode::RemoveMe() ...@@ -678,9 +677,8 @@ void SwNumberTreeNode::RemoveMe()
if (pSavedParent) if (pSavedParent)
pSavedParent->ClearObsoletePhantoms(); pSavedParent->ClearObsoletePhantoms();
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
if (! IsSane(false)) SAL_WARN_IF(!IsSane(false), "sw.core", "insanity");
clog << __FUNCTION__ << ": insanity!" << endl;
#endif #endif
} }
} }
...@@ -858,7 +856,7 @@ SwNumberTreeNode::GetChildCount() const ...@@ -858,7 +856,7 @@ SwNumberTreeNode::GetChildCount() const
return mChildren.size(); return mChildren.size();
} }
#ifdef __SW_NUMBER_TREE_SANITY_CHECK #ifdef DBG_UTIL
bool SwNumberTreeNode::IsSane(bool bRecursive) const bool SwNumberTreeNode::IsSane(bool bRecursive) const
{ {
vector<const SwNumberTreeNode*> aParents; vector<const SwNumberTreeNode*> aParents;
...@@ -941,7 +939,7 @@ bool SwNumberTreeNode::IsSane(bool bRecursive, ...@@ -941,7 +939,7 @@ bool SwNumberTreeNode::IsSane(bool bRecursive,
return bResult; return bResult;
} }
#endif // __SW_NUMBER_TREE_SANITY_CHECK #endif // DBG_UTIL
SwNumberTreeNode::tSwNumberTreeChildren::const_iterator SwNumberTreeNode::tSwNumberTreeChildren::const_iterator
SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment