diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-21 09:30:16 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-21 09:30:16 +1000 |
commit | 261277783fa16e0c974b1981a5eb0a208fca955e (patch) | |
tree | f9a75c9fd718ef57994b775e6d653983e5634085 | |
parent | cd65e0b6478f38b809dd08805e7795a9d8b669eb (diff) | |
download | scintilla-mirror-261277783fa16e0c974b1981a5eb0a208fca955e.tar.gz |
More consistent deletion of standard methods.
-rw-r--r-- | cocoa/ScintillaCocoa.h | 2 | ||||
-rw-r--r-- | gtk/ScintillaGTK.h | 2 | ||||
-rw-r--r-- | lexlib/StyleContext.h | 2 | ||||
-rw-r--r-- | src/CallTip.h | 2 | ||||
-rw-r--r-- | src/CellBuffer.h | 12 | ||||
-rw-r--r-- | src/ContractionState.h | 3 | ||||
-rw-r--r-- | src/Document.h | 3 | ||||
-rw-r--r-- | src/EditModel.h | 2 | ||||
-rw-r--r-- | src/EditView.h | 3 | ||||
-rw-r--r-- | src/Editor.h | 5 | ||||
-rw-r--r-- | src/Partitioning.h | 7 | ||||
-rw-r--r-- | src/PerLine.h | 20 | ||||
-rw-r--r-- | src/PositionCache.cxx | 16 | ||||
-rw-r--r-- | src/PositionCache.h | 16 | ||||
-rw-r--r-- | src/RESearch.h | 1 | ||||
-rw-r--r-- | src/RunStyles.h | 3 | ||||
-rw-r--r-- | src/ScintillaBase.h | 2 | ||||
-rw-r--r-- | src/SparseVector.h | 3 | ||||
-rw-r--r-- | src/SplitVector.h | 4 | ||||
-rw-r--r-- | src/ViewStyle.h | 4 | ||||
-rw-r--r-- | src/XPM.h | 2 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 6 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 2 |
23 files changed, 100 insertions, 22 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 37e640f58..e894228e7 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -131,7 +131,7 @@ protected: public: ScintillaCocoa(ScintillaView* sciView_, SCIContentView* viewContent, SCIMarginView* viewMargin); - // Deleted so ScintillaCocoa objects can not be copied + // Deleted so ScintillaCocoa objects can not be copied. ScintillaCocoa(const ScintillaCocoa &) = delete; ScintillaCocoa &operator=(const ScintillaCocoa &) = delete; ~ScintillaCocoa() override; diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h index c227d7b77..a20f3bcd4 100644 --- a/gtk/ScintillaGTK.h +++ b/gtk/ScintillaGTK.h @@ -73,7 +73,7 @@ class ScintillaGTK : public ScintillaBase { public: explicit ScintillaGTK(_ScintillaObject *sci_); - // Deleted so ScintillaGTK objects can not be copied + // Deleted so ScintillaGTK objects can not be copied. ScintillaGTK(const ScintillaGTK &) = delete; ScintillaGTK &operator=(const ScintillaGTK &) = delete; virtual ~ScintillaGTK(); diff --git a/lexlib/StyleContext.h b/lexlib/StyleContext.h index 7b2f59c00..a536822e2 100644 --- a/lexlib/StyleContext.h +++ b/lexlib/StyleContext.h @@ -95,7 +95,7 @@ public: GetNextChar(); } - // Deleted so StyleContext objects can not be copied + // Deleted so StyleContext objects can not be copied. StyleContext(const StyleContext &) = delete; StyleContext &operator=(const StyleContext &) = delete; void Complete() { diff --git a/src/CallTip.h b/src/CallTip.h index aec915373..ad669fa22 100644 --- a/src/CallTip.h +++ b/src/CallTip.h @@ -53,7 +53,7 @@ public: int verticalOffset; // pixel offset up or down of the calltip with respect to the line CallTip(); - // Deleted so CallTip objects can not be copied + // Deleted so CallTip objects can not be copied. CallTip(const CallTip &) = delete; CallTip &operator=(const CallTip &) = delete; ~CallTip(); diff --git a/src/CellBuffer.h b/src/CellBuffer.h index c073d5e5e..8667b8bfa 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -32,6 +32,9 @@ class LineVector { public: LineVector(); + // Deleted so LineVector objects can not be copied. + LineVector(const LineVector &) = delete; + void operator=(const LineVector &) = delete; ~LineVector(); void Init(); void SetPerLine(PerLine *pl); @@ -63,6 +66,9 @@ public: bool mayCoalesce; Action(); + // Deleted so Action objects can not be copied. + Action(const Action &) = delete; + void operator=(const Action &) = delete; ~Action(); void Create(actionType at_, Sci::Position position_=0, const char *data_=0, Sci::Position lenData_=0, bool mayCoalesce_=true); void Destroy(); @@ -85,8 +91,9 @@ class UndoHistory { public: UndoHistory(); - // Deleted so UndoHistory objects can not be copied + // Deleted so UndoHistory objects can not be copied. UndoHistory(const UndoHistory &) = delete; + void operator=(const UndoHistory &) = delete; ~UndoHistory(); const char *AppendAction(actionType at, Sci::Position position, const char *data, Sci::Position lengthData, bool &startSequence, bool mayCoalesce=true); @@ -145,6 +152,9 @@ private: public: CellBuffer(); + // Deleted so CellBuffer objects can not be copied. + CellBuffer(const CellBuffer &) = delete; + void operator=(const CellBuffer &) = delete; ~CellBuffer(); /// Retrieving positions outside the range of the buffer works and returns 0 diff --git a/src/ContractionState.h b/src/ContractionState.h index 91146f409..5df68a0de 100644 --- a/src/ContractionState.h +++ b/src/ContractionState.h @@ -36,6 +36,9 @@ class ContractionState { public: ContractionState(); + // Deleted so ContractionState objects can not be copied. + ContractionState(const ContractionState &) = delete; + void operator=(const ContractionState &) = delete; virtual ~ContractionState(); void Clear(); diff --git a/src/Document.h b/src/Document.h index b8a88c0df..b6c9c5bd1 100644 --- a/src/Document.h +++ b/src/Document.h @@ -260,6 +260,9 @@ public: DecorationList decorations; Document(); + // Deleted so Document objects can not be copied. + Document(const Document &) = delete; + void operator=(const Document &) = delete; virtual ~Document(); int AddRef(); diff --git a/src/EditModel.h b/src/EditModel.h index e8b031a65..087cf4934 100644 --- a/src/EditModel.h +++ b/src/EditModel.h @@ -53,7 +53,7 @@ public: Document *pdoc; EditModel(); - // Deleted so EditModel objects can not be copied + // Deleted so EditModel objects can not be copied. explicit EditModel(const EditModel &) = delete; EditModel &operator=(const EditModel &) = delete; virtual ~EditModel(); diff --git a/src/EditView.h b/src/EditView.h index d884019d4..7a3926aa2 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -90,6 +90,9 @@ public: DrawWrapMarkerFn customDrawWrapMarker; EditView(); + // Deleted so EditView objects can not be copied. + EditView(const EditView &) = delete; + void operator=(const EditView &) = delete; virtual ~EditView(); bool SetTwoPhaseDraw(bool twoPhaseDraw); diff --git a/src/Editor.h b/src/Editor.h index 4e5e56f5b..9ddb753e6 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -257,7 +257,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool convertPastes; Editor(); - // Deleted so Editor objects can not be copied + // Deleted so Editor objects can not be copied. explicit Editor(const Editor &) = delete; Editor &operator=(const Editor &) = delete; ~Editor() override; @@ -624,6 +624,9 @@ public: } } } + // Deleted so AutoSurface objects can not be copied. + AutoSurface(const AutoSurface &) = delete; + void operator=(const AutoSurface &) = delete; ~AutoSurface() { delete surf; } diff --git a/src/Partitioning.h b/src/Partitioning.h index 2c82cfac9..726b7fcdb 100644 --- a/src/Partitioning.h +++ b/src/Partitioning.h @@ -22,6 +22,9 @@ public: SetGrowSize(growSize_); ReAllocate(growSize_); } + // Deleted so SplitVectorWithRangeAdd objects can not be copied. + SplitVectorWithRangeAdd(const SplitVectorWithRangeAdd &) = delete; + void operator=(const SplitVectorWithRangeAdd &) = delete; ~SplitVectorWithRangeAdd() { } void RangeAddDelta(int start, int end, int delta) { @@ -92,6 +95,10 @@ public: Allocate(growSize); } + // Deleted so Partitioning objects can not be copied. + Partitioning(const Partitioning &) = delete; + void operator=(const Partitioning &) = delete; + ~Partitioning() { delete body; body = 0; diff --git a/src/PerLine.h b/src/PerLine.h index faf4c1cd8..300a50a86 100644 --- a/src/PerLine.h +++ b/src/PerLine.h @@ -30,6 +30,9 @@ class MarkerHandleSet { public: MarkerHandleSet(); + // Deleted so MarkerHandleSet objects can not be copied. + MarkerHandleSet(const MarkerHandleSet &) = delete; + void operator=(const MarkerHandleSet &) = delete; ~MarkerHandleSet(); int Length() const; int MarkValue() const; ///< Bit set of marker numbers. @@ -47,6 +50,9 @@ class LineMarkers : public PerLine { public: LineMarkers() : handleCurrent(0) { } + // Deleted so Worker objects can not be copied. + LineMarkers(const LineMarkers &) = delete; + void operator=(const LineMarkers &) = delete; virtual ~LineMarkers(); void Init() override; void InsertLine(Sci::Line line) override; @@ -64,6 +70,11 @@ public: class LineLevels : public PerLine { SplitVector<int> levels; public: + LineLevels() { + } + // Deleted so Worker objects can not be copied. + LineLevels(const LineLevels &) = delete; + void operator=(const LineLevels &) = delete; virtual ~LineLevels(); void Init() override; void InsertLine(Sci::Line line) override; @@ -80,6 +91,9 @@ class LineState : public PerLine { public: LineState() { } + // Deleted so Worker objects can not be copied. + LineState(const LineState &) = delete; + void operator=(const LineState &) = delete; virtual ~LineState(); void Init() override; void InsertLine(Sci::Line line) override; @@ -95,6 +109,9 @@ class LineAnnotation : public PerLine { public: LineAnnotation() { } + // Deleted so Worker objects can not be copied. + LineAnnotation(const LineAnnotation &) = delete; + void operator=(const LineAnnotation &) = delete; virtual ~LineAnnotation(); void Init() override; void InsertLine(Sci::Line line) override; @@ -119,6 +136,9 @@ class LineTabstops : public PerLine { public: LineTabstops() { } + // Deleted so Worker objects can not be copied. + LineTabstops(const LineTabstops &) = delete; + void operator=(const LineTabstops &) = delete; virtual ~LineTabstops(); void Init() override; void InsertLine(Sci::Line line) override; diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index c5ba231de..c302f8581 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -561,7 +561,17 @@ bool BreakFinder::More() const { } PositionCacheEntry::PositionCacheEntry() : - styleNumber(0), len(0), clock(0), positions(0) { + styleNumber(0), len(0), clock(0), positions(nullptr) { +} + +// Copy constructor not currently used, but needed for being element in std::vector. +PositionCacheEntry::PositionCacheEntry(const PositionCacheEntry &other) : + styleNumber(other.styleNumber), len(other.styleNumber), clock(other.styleNumber), positions(nullptr) { + if (other.positions) { + const size_t lenData = len + (len / sizeof(XYPOSITION)) + 1; + positions = new XYPOSITION[lenData]; + memcpy(positions, other.positions, lenData * sizeof(XYPOSITION)); + } } void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, @@ -571,7 +581,7 @@ void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, len = len_; clock = clock_; if (s_ && positions_) { - positions = new XYPOSITION[len + (len / 4) + 1]; + positions = new XYPOSITION[len + (len / sizeof(XYPOSITION)) + 1]; for (unsigned int i=0; i<len; i++) { positions[i] = positions_[i]; } @@ -585,7 +595,7 @@ PositionCacheEntry::~PositionCacheEntry() { void PositionCacheEntry::Clear() { delete []positions; - positions = 0; + positions = nullptr; styleNumber = 0; len = 0; clock = 0; diff --git a/src/PositionCache.h b/src/PositionCache.h index f97374cef..e7008a456 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -77,6 +77,9 @@ public: XYPOSITION wrapIndent; // In pixels explicit LineLayout(int maxLineLength_); + // Deleted so LineLayout objects can not be copied. + LineLayout(const LineLayout &) = delete; + void operator=(const LineLayout &) = delete; virtual ~LineLayout(); void Resize(int maxLineLength_); void Free(); @@ -107,6 +110,9 @@ class LineLayoutCache { void AllocateForLevel(Sci::Line linesOnScreen, Sci::Line linesInDoc); public: LineLayoutCache(); + // Deleted so LineLayoutCache objects can not be copied. + LineLayoutCache(const LineLayoutCache &) = delete; + void operator=(const LineLayoutCache &) = delete; virtual ~LineLayoutCache(); void Deallocate(); enum { @@ -130,6 +136,10 @@ class PositionCacheEntry { XYPOSITION *positions; public: PositionCacheEntry(); + // Copy constructor not currently used, but needed for being element in std::vector. + PositionCacheEntry(const PositionCacheEntry &); + // Deleted so PositionCacheEntry objects can not be assigned. + void operator=(const PositionCacheEntry &) = delete; ~PositionCacheEntry(); void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_); void Clear(); @@ -194,8 +204,9 @@ public: enum { lengthEachSubdivision = 100 }; BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, Sci::Position posLineStart_, int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); - // Deleted so BreakFinder objects can not be copied + // Deleted so BreakFinder objects can not be copied. BreakFinder(const BreakFinder &) = delete; + void operator=(const BreakFinder &) = delete; ~BreakFinder(); TextSegment Next(); bool More() const; @@ -207,8 +218,9 @@ class PositionCache { bool allClear; public: PositionCache(); - // Deleted so PositionCache objects can not be copied + // Deleted so PositionCache objects can not be copied. PositionCache(const PositionCache &) = delete; + void operator=(const PositionCache &) = delete; ~PositionCache(); void Clear(); void SetSize(size_t size_); diff --git a/src/RESearch.h b/src/RESearch.h index f61b3008b..b092a6e7c 100644 --- a/src/RESearch.h +++ b/src/RESearch.h @@ -32,6 +32,7 @@ class RESearch { public: explicit RESearch(CharClassify *charClassTable); + // No dynamic allocation so default copy constructor and assignment operator are OK. ~RESearch(); void Clear(); void GrabMatches(CharacterIndexer &ci); diff --git a/src/RunStyles.h b/src/RunStyles.h index 7c5d85ee2..bc5213c5a 100644 --- a/src/RunStyles.h +++ b/src/RunStyles.h @@ -25,8 +25,9 @@ private: void RemoveRunIfSameAsPrevious(int run); public: RunStyles(); - // Deleted so RunStyles objects can not be copied + // Deleted so RunStyles objects can not be copied. RunStyles(const RunStyles &) = delete; + void operator=(const RunStyles &) = delete; ~RunStyles(); int Length() const; int ValueAt(int position) const; diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index 2d104b531..cd8a1f5a1 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -54,7 +54,7 @@ protected: #endif ScintillaBase(); - // Deleted so ScintillaBase objects can not be copied + // Deleted so ScintillaBase objects can not be copied. explicit ScintillaBase(const ScintillaBase &) = delete; ScintillaBase &operator=(const ScintillaBase &) = delete; virtual ~ScintillaBase(); diff --git a/src/SparseVector.h b/src/SparseVector.h index c81170c4b..250ce97ac 100644 --- a/src/SparseVector.h +++ b/src/SparseVector.h @@ -19,8 +19,9 @@ class SparseVector { private: Partitioning *starts; SplitVector<T> *values; - // Deleted so SparseVector objects can not be copied + // Deleted so SparseVector objects can not be copied. SparseVector(const SparseVector &) = delete; + void operator=(const SparseVector &) = delete; void ClearValue(int partition) { values->SetValueAt(partition, T()); } diff --git a/src/SplitVector.h b/src/SplitVector.h index 1601bfaa6..e6a7701bb 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -70,6 +70,10 @@ public: Init(); } + // Deleted so SplitVector objects can not be copied. + SplitVector(const SplitVector &) = delete; + void operator=(const SplitVector &) = delete; + ~SplitVector() { delete []body; body = 0; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 95e1ffc2c..ad482c814 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -32,7 +32,7 @@ private: std::vector<const char *> names; public: FontNames(); - // FontNames objects can not be copied + // FontNames objects can not be copied. FontNames(const FontNames &) = delete; FontNames &operator=(const FontNames &) = delete; ~FontNames(); @@ -44,7 +44,7 @@ class FontRealised : public FontMeasurements { public: Font font; FontRealised(); - // FontRealised objects can not be copied + // FontRealised objects can not be copied. FontRealised(const FontRealised &) = delete; FontRealised &operator=(const FontRealised &) = delete; virtual ~FontRealised(); @@ -50,7 +50,7 @@ class RGBAImage { public: RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_); explicit RGBAImage(const XPM &xpm); - // Deleted so RGBAImage objects can not be copied + // Deleted so RGBAImage objects can not be copied. RGBAImage(const RGBAImage &) = delete; RGBAImage &operator=(const RGBAImage &) = delete; virtual ~RGBAImage(); diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 75d981def..b54b11954 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -466,7 +466,7 @@ public: buffer = bufferStandard; } } - // Deleted so VarBuffer objects can not be copied + // Deleted so VarBuffer objects can not be copied. VarBuffer(const VarBuffer &) = delete; VarBuffer &operator=(const VarBuffer &) = delete; ~VarBuffer() { @@ -515,7 +515,7 @@ class SurfaceGDI : public Surface { public: SurfaceGDI(); - // Deleted so SurfaceGDI objects can not be copied + // Deleted so SurfaceGDI objects can not be copied. SurfaceGDI(const SurfaceGDI &) = delete; SurfaceGDI &operator=(const SurfaceGDI &) = delete; ~SurfaceGDI() override; @@ -1073,7 +1073,7 @@ class SurfaceD2D : public Surface { public: SurfaceD2D(); - // Deleted so SurfaceD2D objects can not be copied + // Deleted so SurfaceD2D objects can not be copied. SurfaceD2D(const SurfaceD2D &) = delete; SurfaceD2D &operator=(const SurfaceD2D &) = delete; virtual ~SurfaceD2D() override; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 91a68fbf2..155ebdb72 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -272,7 +272,7 @@ class ScintillaWin : #endif explicit ScintillaWin(HWND hwnd); - // Deleted so ScintillaWin objects can not be copied + // Deleted so ScintillaWin objects can not be copied. ScintillaWin(const ScintillaWin &) = delete; ScintillaWin &operator=(const ScintillaWin &) = delete; ~ScintillaWin() override; |