mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
interfaces: remove implicit conversion operators
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
58f74694c7
commit
463adcca11
4 changed files with 11 additions and 23 deletions
|
@ -62,7 +62,7 @@ bool MovingCursor::atEndOfLine() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MovingCursor::atEndOfDocument() const {
|
bool MovingCursor::atEndOfDocument() const {
|
||||||
return *this == document()->documentEnd();
|
return toCursor() == document()->documentEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MovingCursor::atStartOfDocument() const {
|
bool MovingCursor::atStartOfDocument() const {
|
||||||
|
@ -143,7 +143,7 @@ bool MovingCursor::move(int chars, WrapBehavior wrapBehavior)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != *this) {
|
if (c != toCursor()) {
|
||||||
setPosition(c);
|
setPosition(c);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -270,13 +270,6 @@ class KTEXTEDITOR_EXPORT MovingCursor
|
||||||
*/
|
*/
|
||||||
const Cursor toCursor () const { return Cursor (line(), column()); }
|
const Cursor toCursor () const { return Cursor (line(), column()); }
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert this clever cursor into a dumb one. Equal to toCursor, allowing to use implicit conversion.
|
|
||||||
* Even if this cursor belongs to a range, the created one not.
|
|
||||||
* @return normal cursor
|
|
||||||
*/
|
|
||||||
operator const Cursor () const { return Cursor (line(), column()); }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// operators for: MovingCursor <-> MovingCursor
|
// operators for: MovingCursor <-> MovingCursor
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,14 +41,15 @@ void MovingRange::setRange (const Cursor &start, const Cursor &end)
|
||||||
|
|
||||||
bool MovingRange::overlaps( const Range& range ) const
|
bool MovingRange::overlaps( const Range& range ) const
|
||||||
{
|
{
|
||||||
if (range.start() <= start())
|
const Cursor startcursor = start().toCursor();
|
||||||
return range.end() > start();
|
if (range.start() <= startcursor)
|
||||||
|
return range.end() > startcursor;
|
||||||
|
|
||||||
else if (range.end() >= end())
|
const Cursor endcursor = end().toCursor();
|
||||||
return range.start() < end();
|
if (range.end() >= endcursor)
|
||||||
|
return range.start() < endcursor;
|
||||||
|
|
||||||
else
|
return contains(range);
|
||||||
return contains(range);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 2; replace-tabs on;
|
// kate: space-indent on; indent-width 2; replace-tabs on;
|
||||||
|
|
|
@ -332,12 +332,6 @@ class KTEXTEDITOR_EXPORT MovingRange
|
||||||
*/
|
*/
|
||||||
const Range toRange () const { return Range (start().toCursor(), end().toCursor()); }
|
const Range toRange () const { return Range (start().toCursor(), end().toCursor()); }
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert this clever range into a dumb one. Equal to toRange, allowing to use implicit conversion.
|
|
||||||
* @return normal range
|
|
||||||
*/
|
|
||||||
operator const Range () const { return Range (start().toCursor(), end().toCursor()); }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* kDebug() stream operator. Writes this range to the debug output in a nicely formatted way.
|
* kDebug() stream operator. Writes this range to the debug output in a nicely formatted way.
|
||||||
* @param s debug stream
|
* @param s debug stream
|
||||||
|
@ -387,7 +381,7 @@ class KTEXTEDITOR_EXPORT MovingRange
|
||||||
* \return \e true, if this range contains \e range, otherwise \e false
|
* \return \e true, if this range contains \e range, otherwise \e false
|
||||||
*/
|
*/
|
||||||
inline bool contains(const Range& range) const {
|
inline bool contains(const Range& range) const {
|
||||||
return range.start() >= start() && range.end() <= end();
|
return range.start() >= start().toCursor() && range.end() <= end().toCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -398,7 +392,7 @@ class KTEXTEDITOR_EXPORT MovingRange
|
||||||
* \return \e true if the cursor is contained within this range, otherwise \e false.
|
* \return \e true if the cursor is contained within this range, otherwise \e false.
|
||||||
*/
|
*/
|
||||||
inline bool contains(const Cursor& cursor) const {
|
inline bool contains(const Cursor& cursor) const {
|
||||||
return cursor >= start() && cursor < end();
|
return cursor >= start().toCursor() && cursor < end().toCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue