1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2007-2011 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "DiffStates.h"
33 * \ingroup TortoiseMerge
34 * Holds the information which is required to define a single line of text.
40 : state(DIFFSTATE_UNKNOWN
)
43 , ending(EOL_AUTOLINE
)
44 , hidestate(HIDESTATE_HIDDEN
)
49 const CString
& sLineInit
,
56 , linenumber(linenumberInit
)
57 , movedIndex(movedIndexInit
)
73 * \ingroup TortoiseMerge
74 * Handles the view and diff data a TortoiseMerge view needs.
82 void AddData(const CString
& sLine
, DiffStates state
, int linenumber
, EOL ending
, HIDESTATE hide
, int movedline
);
83 void AddData(const viewdata
& data
);
84 void AddEmpty() {AddData(CString(), DIFFSTATE_EMPTY
, -1, EOL_NOENDING
, HIDESTATE_SHOWN
, -1);}
85 void InsertData(int index
, const CString
& sLine
, DiffStates state
, int linenumber
, EOL ending
, HIDESTATE hide
, int movedline
);
86 void InsertData(int index
, const viewdata
& data
);
87 void RemoveData(int index
) {m_data
.erase(m_data
.begin() + index
);}
89 const viewdata
& GetData(int index
) {return m_data
[index
];}
90 const CString
& GetLine(int index
) const {return m_data
[index
].sLine
;}
91 DiffStates
GetState(int index
) const {return m_data
[index
].state
;}
92 HIDESTATE
GetHideState(int index
) {return m_data
[index
].hidestate
;}
93 int GetLineNumber(int index
) {return m_data
.size() ? m_data
[index
].linenumber
: 0;}
94 int GetMovedIndex(int index
) {return m_data
.size() ? m_data
[index
].movedIndex
: 0;}
95 int FindLineNumber(int number
);
96 EOL
GetLineEnding(int index
) const {return m_data
[index
].ending
;}
98 int GetCount() { return (int)m_data
.size(); }
100 void SetData(int index
, const viewdata
& data
) {m_data
[index
] = data
;};
101 void SetState(int index
, DiffStates state
) {m_data
[index
].state
= state
;}
102 void SetLine(int index
, const CString
& sLine
) {m_data
[index
].sLine
= sLine
;}
103 void SetLineNumber(int index
, int linenumber
) {m_data
[index
].linenumber
= linenumber
;}
104 void SetLineEnding(int index
, EOL ending
) {m_data
[index
].ending
= ending
;}
105 void SetMovedIndex(int index
, int movedIndex
) {m_data
[index
].movedIndex
= movedIndex
;}
106 void SetLineHideState(int index
, HIDESTATE state
) {m_data
[index
].hidestate
= state
;}
108 void Clear() {m_data
.clear();}
109 void Reserve(int length
) {m_data
.reserve(length
);}
112 std::vector
<viewdata
> m_data
;