WSF
TextSourceChange.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2016 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef TEXTSOURCECHANGE_HPP
13#define TEXTSOURCECHANGE_HPP
14
15#include <QDataStream>
16#include <QVector>
17
18#include "UtTextDocument.hpp"
19#include "ViExport.hpp"
20
21namespace wizard
22{
24{
26 : mText()
27 , mPos(0)
28 , mCharsRemoved(0)
29 , mSequenceNumber(-1)
30 {
31 }
32
33 // Update a range of text after applying this change
34 void ApplyChangeToRange(UtTextRange& aRange) const;
35 size_t ApplyChangeToPos(size_t aPos) const;
36 void ApplyToDocument(UtTextDocument& aDocument) const;
37
38 // Applies the change to a document which represents only a section of the source document.
39 void ApplyToPartialDocument(UtTextDocument& aDocument, UtTextRange& aSection) const;
40 bool operator==(const TextSourceChange& aRhs);
41
42 std::string mText;
43 size_t mPos;
46 long long mSequenceNumber;
47};
48
49// Apply a list of changes to a document
50void ApplyToDocument(UtTextDocument& aDocument, const QVector<TextSourceChange>& aChanges);
51} // namespace wizard
52VI_EXPORT QDataStream& operator<<(QDataStream& s, const wizard::TextSourceChange& d);
53VI_EXPORT QDataStream& operator>>(QDataStream& s, wizard::TextSourceChange& d);
54
55#endif
VI_EXPORT QDataStream & operator<<(QDataStream &s, const wizard::TextSourceChange &d)
Definition TextSourceChange.cpp:141
VI_EXPORT QDataStream & operator>>(QDataStream &s, wizard::TextSourceChange &d)
Definition TextSourceChange.cpp:148
#define VI_EXPORT
Definition ViExport.hpp:38
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
Definition Runner.hpp:22
void ApplyToDocument(UtTextDocument &aDocument, const QVector< TextSourceChange > &aChanges)
Definition TextSourceChange.cpp:128
Definition TextSourceChange.hpp:24
size_t mPos
Definition TextSourceChange.hpp:43
std::string mText
Definition TextSourceChange.hpp:42
TextSourceChange()
Definition TextSourceChange.hpp:25
size_t mCharsRemoved
Definition TextSourceChange.hpp:44
long long mSequenceNumber
Records the time the change was made.
Definition TextSourceChange.hpp:46
Copyrights Multiple, All Rights Reserved