• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • kde-4.14
  • applications
  • kate
  • ktexteditor
movingrange.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
4  *
5  * Based on code of the SmartCursor/Range by:
6  * Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #include "movingrange.h"
25 
26 using namespace KTextEditor;
27 
28 MovingRange::MovingRange ()
29 {
30 }
31 
32 MovingRange::~MovingRange ()
33 {
34 }
35 
36 void MovingRange::setRange (const Cursor &start, const Cursor &end)
37 {
38  // just use other function, KTextEditor::Range will handle some normalization
39  setRange (Range (start, end));
40 }
41 
42 bool MovingRange::overlaps( const Range& range ) const
43 {
44  if (range.start() <= start())
45  return range.end() > start();
46 
47  else if (range.end() >= end())
48  return range.start() < end();
49 
50  else
51  return contains(range);
52 }
53 
54 // kate: space-indent on; indent-width 2; replace-tabs on;
KTextEditor::Range::start
Cursor & start()
Get the start position of this range.
Definition: range.cpp:296
movingrange.h
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:55
KTextEditor::MovingRange::contains
bool contains(const Range &range) const
Check whether the this range wholly encompasses range.
Definition: movingrange.h:399
KTextEditor::MovingRange::setRange
virtual void setRange(const KTextEditor::Range &range)=0
Set the range of this range.
KTextEditor::MovingRange::MovingRange
MovingRange()
For inherited class only.
Definition: movingrange.cpp:28
KTextEditor::Range
An object representing a section of text, from one Cursor to another.
Definition: range.h:54
KTextEditor::MovingRange::start
virtual const MovingCursor & start() const =0
Retrieve start cursor of this range, read-only.
KTextEditor::Range::end
Cursor & end()
Get the end position of this range.
Definition: range.cpp:306
KTextEditor::MovingRange::~MovingRange
virtual ~MovingRange()
Destruct the moving range.
Definition: movingrange.cpp:32
KTextEditor::MovingRange::end
virtual const MovingCursor & end() const =0
Retrieve end cursor of this range, read-only.
KTextEditor::MovingRange::overlaps
bool overlaps(const Range &range) const
Check whether the this range overlaps with range.
Definition: movingrange.cpp:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal