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

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • gui
coordrange.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Gui library, made within the KDE community.
3 
4  Copyright 2003,2009 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef OKTETA_COORDRANGE_H
24 #define OKTETA_COORDRANGE_H
25 
26 // lib
27 #include "coord.h"
28 #include "linepositionrange.h"
29 #include "linerange.h"
30 // Okteta core
31 #include "range.h"
32 
33 
34 namespace KDE
35 {
36 
37 typedef Range<Okteta::Coord> KBaseCoordRange;
38 
39 template<>
40 inline const Okteta::Coord KBaseCoordRange::null() const
41 { return Okteta::Coord(-1,-1); }
42 
43 }
44 
45 namespace Okteta
46 {
47 
51 class CoordRange : public KDE::KBaseCoordRange
52 {
53  public:
58  CoordRange( const Coord& start, const Coord& end );
63  CoordRange( const LinePositionRange& posRange, const LineRange& lineRange );
64  CoordRange();
65  ~CoordRange();
66 
67  public:
68  CoordRange &operator=( const CoordRange& other );
69 
70  public:
71  bool operator==( const CoordRange& other ) const;
72 
73  public:
79  Size width( LinePositionSize lineWidth ) const;
84  LineSize lines() const;
90  bool includesLine( Line line ) const;
91 };
92 
93 
94 inline CoordRange::CoordRange( const Coord& start, const Coord& end ) : KDE::KBaseCoordRange(start,end) {}
95 inline CoordRange::CoordRange( const LinePositionRange& posRange, const LineRange& lineRange )
96  : KDE::KBaseCoordRange( Coord(posRange.start(),lineRange.start()), Coord(posRange.end(),lineRange.end()) ) {}
97 inline CoordRange::CoordRange() {}
98 
99 inline CoordRange::~CoordRange() {}
100 
101 inline CoordRange& CoordRange::operator=( const CoordRange& other ) { KDE::KBaseCoordRange::operator=(other); return *this; }
102 
103 inline bool CoordRange::operator==( const CoordRange& other ) const { return KDE::KBaseCoordRange::operator==(other); }
104 
105 inline Size CoordRange::width( LinePositionSize lineWidth ) const { return lineWidth*(lines()-1) + end().pos() - start().pos()+1; }
106 inline LineSize CoordRange::lines() const { return end().line() - start().line() + 1; }
107 inline bool CoordRange::includesLine( Line line ) const { return ( start().line() <= line && line <= end().line() ); }
108 
109 }
110 
111 #endif
Okteta::CoordRange
describes a range in the buffercoord
Definition: coordrange.h:51
Okteta::CoordRange::CoordRange
CoordRange()
Definition: coordrange.h:97
Okteta::CoordRange::~CoordRange
~CoordRange()
Definition: coordrange.h:99
Okteta::CoordRange::operator=
CoordRange & operator=(const CoordRange &other)
Definition: coordrange.h:101
coord.h
KDE::NumberRange< LinePosition, LinePositionSize >
KDE::Range::start
T start() const
Definition: range.h:86
KDE::Range::null
const T null() const
delivers a null element.
Definition: range.h:129
KDE::Range
This template describes a range.
Definition: range.h:38
Okteta::Coord
a class which represents a coord in a 2-dim.
Definition: coord.h:47
KDE::KBaseCoordRange
Range< Okteta::Coord > KBaseCoordRange
Definition: coordrange.h:37
Okteta::Line
qint32 Line
Definition: line.h:33
range.h
KDE::Range::end
T end() const
Definition: range.h:88
KDE::Range::operator=
Range & operator=(const Range &R)
Definition: range.h:46
linepositionrange.h
linerange.h
KDE::Range::operator==
bool operator==(const Range &R) const
Definition: range.h:49
Okteta::LinePositionSize
qint32 LinePositionSize
Definition: lineposition.h:34
Okteta::CoordRange::width
Size width(LinePositionSize lineWidth) const
calculates the number of coords that are covered if a line has the given length.
Definition: coordrange.h:105
Okteta::Size
qint32 Size
Definition: size.h:33
Okteta::CoordRange::includesLine
bool includesLine(Line line) const
tests if the given line is included by the range.
Definition: coordrange.h:107
Okteta::CoordRange::operator==
bool operator==(const CoordRange &other) const
Definition: coordrange.h:103
Okteta::CoordRange::lines
LineSize lines() const
calculates the number of lines that are covered by the range.
Definition: coordrange.h:106
Okteta::LineSize
qint32 LineSize
Definition: line.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

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

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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