KTextEditor
movingrange.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org> 00004 * 00005 * Based on code of the SmartCursor/Range by: 00006 * Copyright (C) 2003-2005 Hamish Rodda <rodda@kde.org> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public License 00019 * along with this library; see the file COPYING.LIB. If not, write to 00020 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 * Boston, MA 02110-1301, USA. 00022 */ 00023 00024 #include "movingrange.h" 00025 00026 using namespace KTextEditor; 00027 00028 MovingRange::MovingRange () 00029 { 00030 } 00031 00032 MovingRange::~MovingRange () 00033 { 00034 } 00035 00036 void MovingRange::setRange (const Cursor &start, const Cursor &end) 00037 { 00038 // just use other function, KTextEditor::Range will handle some normalization 00039 setRange (Range (start, end)); 00040 } 00041 00042 bool MovingRange::overlaps( const Range& range ) const 00043 { 00044 if (range.start() <= start()) 00045 return range.end() > start(); 00046 00047 else if (range.end() >= end()) 00048 return range.start() < end(); 00049 00050 else 00051 return contains(range); 00052 } 00053 00054 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference