~ubuntu-branches/ubuntu/oneiric/kdesdk/oneiric-updates

« back to all changes in this revision

Viewing changes to okteta/core/piecetable/piece.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers, Modestas Vainius, George Kiagiadakis, José Manuel Santamaría Lema, Pino Toscano
  • Date: 2011-04-27 12:23:44 UTC
  • mfrom: (1.1.58 upstream) (0.5.7 squeeze)
  • mto: (0.5.8 sid)
  • mto: This revision was merged to the branch mainline in revision 120.
  • Revision ID: james.westby@ubuntu.com-20110427122344-t9d1jf4lfnrl6hyv
Tags: 4:4.6.2-1
* New upstream release:
  - fixes plugin loading in kate sessions (Closes: #525853)
  - updates kate man page with respect to instance creation defaults
    (Closes: #598443)
  - fixes cursor position with static word-wrap in Kate (Closes: #570409)
  - xml2pot creates .pot files with the correct mimetype (Closes: #326060)
* Update installed files.
* Update lintian overrides.

[ Modestas Vainius ]
* Point debian/control Vcs fields to the new Git repository.
* Strip sequence numbers from debian/patches.
* Strip trailing whitespace in debian/copyright.
* Add kdeutils-dbg (<< 4:4.6) to kdesdk-dbg Breaks/Replaces (due to moved
  okteta).
* Add ${perl:Depends} to Depends of cervisia and kdesdk-kio-plugins.

[ George Kiagiadakis ]
* Add myself to uploaders.
* Refresh patch 02_append_kde.diff.
* Drop patch 03_kmtrace_compile.diff; fixed upstream in a better way.
* Add libkonq5-dev, libantlr-dev and antlr to build depends.
  (Closes: #505425)
* Bump kdepimlibs5-dev build dependency to version 4:4.6.
* Add new package: kdesdk-dolphin-plugins.

[ José Manuel Santamaría Lema ]
* Remove package kbugbuster.
* Enable DebianABIManager:
  - include DebianABIManager.cmake at the bottom of the main CMakeLists.txt
    (patch enable_debianabimanager.diff).
  - debian/control: managing all non-local unstable-BC libraries.
* Add packages for okteta:
  - okteta
  - okteta-dev
  - libkastencontrollers4
  - libkastencore4
  - libkastengui4
  - liboktetacore4
  - liboktetagui4
  - liboktetakastencontrollers4
  - liboktetakastencore4
  - liboktetakastengui4
* Add symbols files for new library packages.
* Bump kde-sc-dev-latest build dependency to 4:4.6.2.
* Bump pkg-kde-tools build dependency to 0.12.
* Switch debian/rules engine to dhmk based qt-kde-team/2/*
  - and remove cdbs from Build-Depends.
* Bump S-V to 3.9.1; update Replaces/Breaks/Conflicts.
* Add myself to Uploaders.

[ Pino Toscano ]
* Add build dependency on libqca2-dev.
* Do not ship kdesrc-build with kdesdk-scripts, it is packaged separately.
* Small updates to descriptions.
* Clean up Replaces/Breaks from the pre-squeeze era whenever possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of the Okteta Core library, part of the KDE project.
 
3
 
 
4
    Copyright 2008 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 KPIECETABLE_PIECE_H
 
24
#define KPIECETABLE_PIECE_H
 
25
 
 
26
 
 
27
// lib
 
28
#include <addressrange.h>
 
29
 
 
30
namespace KPieceTable
 
31
{
 
32
 
 
33
typedef Okteta::Size Size;
 
34
typedef Okteta::Address Address;
 
35
typedef Okteta::AddressRange AddressRange;
 
36
 
 
37
 
 
38
class Piece : public AddressRange
 
39
{
 
40
  public:
 
41
    enum {
 
42
        OriginalStorage,
 
43
        ChangeStorage
 
44
    };
 
45
 
 
46
  public:
 
47
    Piece( Address storageOffset, Size size, int storageId );
 
48
    Piece( const AddressRange& storageRange, int storageId );
 
49
    Piece();
 
50
 
 
51
  public:
 
52
    int storageId() const;
 
53
 
 
54
  public:
 
55
    void setStorageId( int storageId );
 
56
    Piece splitAt( Address storageOffset );
 
57
    Piece splitAtLocal( Address localStorageOffset );
 
58
    Piece remove( const AddressRange& removeStorageRange );
 
59
    Piece removeLocal( const AddressRange& localRemoveStorageRange );
 
60
    Piece removeStartBeforeLocal( Address storageOffset );
 
61
    Piece removeEndBehindLocal( Address storageOffset );
 
62
    bool prepend( const Piece& other );
 
63
    bool append( const Piece& other );
 
64
 
 
65
  public:
 
66
    Piece subPiece( const AddressRange& local ) const;
 
67
 
 
68
  protected:
 
69
    int mStorageId;
 
70
};
 
71
 
 
72
 
 
73
inline Piece::Piece( Address storageOffset, Size size, int storageId )
 
74
  : AddressRange( AddressRange::fromWidth(storageOffset,size) ),
 
75
    mStorageId( storageId )
 
76
{}
 
77
inline Piece::Piece( const AddressRange& storageRange, int storageId )
 
78
  : AddressRange( storageRange ),
 
79
    mStorageId( storageId )
 
80
{}
 
81
inline Piece::Piece() : mStorageId(OriginalStorage) {}
 
82
 
 
83
inline int Piece::storageId() const { return mStorageId; }
 
84
 
 
85
inline void Piece::setStorageId( int storageId ) { mStorageId = storageId; }
 
86
 
 
87
inline Piece Piece::splitAt( Address storageOffset )
 
88
{
 
89
    return Piece( AddressRange::splitAt(storageOffset), mStorageId );
 
90
}
 
91
inline Piece Piece::splitAtLocal( Address localStorageOffset )
 
92
{
 
93
    return Piece( AddressRange::splitAtLocal(localStorageOffset), mStorageId );
 
94
}
 
95
inline Piece Piece::remove( const AddressRange& removeStorageRange )
 
96
{
 
97
    return Piece( AddressRange::remove(removeStorageRange), mStorageId );
 
98
}
 
99
inline Piece Piece::removeLocal( const AddressRange& localRemoveStorageRange )
 
100
{
 
101
    return Piece( AddressRange::removeLocal(localRemoveStorageRange), mStorageId );
 
102
}
 
103
inline Piece Piece::removeStartBeforeLocal( Address storageOffset )
 
104
{
 
105
    const Address oldStart = start();
 
106
    moveStartBy( storageOffset );
 
107
    return Piece( AddressRange(oldStart,nextBeforeStart()), mStorageId );
 
108
}
 
109
inline Piece Piece::removeEndBehindLocal( Address storageOffset )
 
110
{
 
111
    const Address oldEnd = end();
 
112
    setEndByWidth( storageOffset+1 );
 
113
    return Piece( AddressRange(nextBehindEnd(),oldEnd), mStorageId );
 
114
}
 
115
 
 
116
inline Piece Piece::subPiece( const AddressRange& local ) const
 
117
{
 
118
    return Piece( AddressRange::subRange(local), mStorageId );
 
119
}
 
120
 
 
121
inline bool Piece::prepend( const Piece& other )
 
122
{
 
123
    const bool result = ( mStorageId == other.mStorageId && AddressRange::prepend(other) );
 
124
    return result;
 
125
}
 
126
inline bool Piece::append( const Piece& other )
 
127
{
 
128
    const bool result = ( mStorageId == other.mStorageId && AddressRange::append(other) );
 
129
    return result;
 
130
}
 
131
 
 
132
}
 
133
 
 
134
#endif