edbee - Qt Editor Library
abstractrangedchange.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "edbee/models/change.h"
9 
10 namespace edbee {
11 
16 {
17 public:
18  virtual ~AbstractRangedChange();
19 
21  virtual int offset() const = 0;
22 
24  virtual void setOffset( int value ) = 0;
25  void addOffset( int amount );
26 
28  virtual void setDocLength( int value ) = 0;
29 
31  virtual int docLength() const = 0;
32 
34  virtual int storedLength() const = 0;
35 
36 
37 protected:
38 
45  virtual void mergeStoredData( AbstractRangedChange* change ) = 0;
46 
47 
50  void mergeStoredDataViaMemcopy(void* targetData, void* data, void* changeData, AbstractRangedChange* change, int itemSize );
51  bool merge( AbstractRangedChange* change );
52 
53 public:
54  bool isOverlappedBy( AbstractRangedChange* secondChange );
55  bool isTouchedBy( AbstractRangedChange* secondChange );
56 
57 };
58 
59 
60 } // edbee
int getMergedStoredLength(AbstractRangedChange *change)
Calculates the merge data size, that's required for merging the given change.
Definition: abstractrangedchange.cpp:50
virtual void setDocLength(int value)=0
this method should set the old length
int getMergedDocLength(AbstractRangedChange *change)
Calculates the merged length.
Definition: abstractrangedchange.cpp:28
virtual void mergeStoredData(AbstractRangedChange *change)=0
implement this method to merge to old data. Sample implementation
bool isTouchedBy(AbstractRangedChange *secondChange)
Touched ranges are ranges that are next to eachother Touching means the end offset of one range is th...
Definition: abstractrangedchange.cpp:158
virtual ~AbstractRangedChange()
default destructor is empty
Definition: abstractrangedchange.cpp:13
virtual int docLength() const =0
this method should return the length in the document
void addOffset(int amount)
Adds the given amount to the offset.
Definition: abstractrangedchange.cpp:20
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
virtual int offset() const =0
this method should return the offset of the change
bool isOverlappedBy(AbstractRangedChange *secondChange)
This method checks if this textchange is overlapped by the second text change overlapping is an exclu...
Definition: abstractrangedchange.cpp:145
A basic change.
Definition: change.h:18
bool merge(AbstractRangedChange *change)
This method merges the change.
Definition: abstractrangedchange.cpp:118
virtual int storedLength() const =0
this method should return the length of this item in memory
This is an abstract class for ranged changes This are changes (text changes and line changes) that sp...
Definition: abstractrangedchange.h:15
virtual void setOffset(int value)=0
this method should set the offset
void mergeStoredDataViaMemcopy(void *targetData, void *data, void *changeData, AbstractRangedChange *change, int itemSize)
This method merges the data via a memcopy. I really don't like this way of merging the data...
Definition: abstractrangedchange.cpp:91