Kaydet (Commit) 12637c63 authored tarafından Luboš Luňák's avatar Luboš Luňák

operator<< for SwPosition/SwPaM/etc. for use with SAL_DEBUG

Change-Id: I99ffa87afa6dbdbd20042a882af428d166546af3
üst 988477e2
......@@ -23,6 +23,8 @@
#include <tools/rtti.hxx>
#include <swdllapi.h>
#include <iostream>
class SwIndexReg;
struct SwPosition;
......@@ -107,6 +109,8 @@ public:
void SetMark(const sw::mark::IMark* pMark);
};
std::ostream& operator <<(std::ostream& s, const SwIndex& index);
class SwIndexReg
{
friend class SwIndex;
......
......@@ -20,6 +20,7 @@
#define INCLUDED_SW_INC_NDINDEX_HXX
#include <limits.h>
#include <iostream>
#include <tools/solar.h>
......@@ -92,6 +93,8 @@ public:
SwNode& GetNode() const { return *pNd; }
};
std::ostream &operator <<(std::ostream& s, const SwNodeIndex& index);
// SwRange
class SW_DLLPUBLIC SwNodeRange
......
......@@ -28,6 +28,8 @@
#include <ndindex.hxx>
#include "swdllapi.h"
#include <iostream>
class SwFmt;
class SfxPoolItem;
class SfxItemSet;
......@@ -74,6 +76,8 @@ struct SW_DLLPUBLIC SwPosition
bool operator !=(const SwPosition &) const;
};
std::ostream &operator <<(std::ostream& s, const SwPosition& position);
// Result of comparing positions.
enum SwComparePosition {
POS_BEFORE, ///< Pos1 before Pos2.
......@@ -301,6 +305,8 @@ public:
void InvalidatePaM();
};
std::ostream &operator <<(std::ostream& s, const SwPaM& pam);
bool CheckNodesRange( const SwNodeIndex&, const SwNodeIndex&, bool bChkSection );
#endif // INCLUDED_SW_INC_PAM_HXX
......
......@@ -392,4 +392,9 @@ SwIndex& SwIndex::operator= ( sal_Int32 const nVal )
#endif
std::ostream& operator <<(std::ostream& s, const SwIndex& index)
{
return s << "SwIndex offset (" << index.GetIndex() << ")";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -190,6 +190,11 @@ SwDoc * SwPosition::GetDoc() const
return nNode.GetNode().GetDoc();
}
std::ostream &operator <<(std::ostream& s, const SwPosition& position)
{
return s << "SwPosition (node " << position.nNode.GetIndex() << ", offset " << position.nContent.GetIndex() << ")";
}
enum CHKSECTION { Chk_Both, Chk_One, Chk_None };
static CHKSECTION lcl_TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, const SwNode& rEndNd )
......@@ -1085,4 +1090,13 @@ void SwPaM::InvalidatePaM()
}
}
std::ostream &operator <<(std::ostream& s, const SwPaM& pam)
{
if( pam.HasMark())
return s << "SwPaM (point " << *pam.GetPoint() << ", mark " << *pam.GetMark() << ")";
else
return s << "SwPaM (point " << *pam.GetPoint() << ")";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -130,4 +130,9 @@ SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
return *this;
}
std::ostream &operator <<(std::ostream& s, const SwNodeIndex& index)
{
return s << "SwNodeIndex (node " << index.GetIndex() << ")";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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