OSDN Git Service

Change Dir Structure to be same as TortoiseSVN'
[tortoisegit/TortoiseGitJp.git] / src / TortoiseMerge / ViewData.h
diff --git a/src/TortoiseMerge/ViewData.h b/src/TortoiseMerge/ViewData.h
new file mode 100644 (file)
index 0000000..d94f29e
--- /dev/null
@@ -0,0 +1,72 @@
+// TortoiseMerge - a Diff/Patch program\r
+\r
+// Copyright (C) 2007-2008 - TortoiseSVN\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#pragma once\r
+#include "DiffStates.h"\r
+#include "EOL.h"\r
+\r
+#include <vector>\r
+\r
+/**\r
+ * \ingroup TortoiseMerge\r
+ * Holds the information which is required to define a single line of text.\r
+ */\r
+typedef struct\r
+{\r
+       CString                                         sLine;\r
+       DiffStates                                      state;\r
+       int                                                     linenumber; \r
+       EOL                                                     ending;\r
+} viewdata;\r
+\r
+/**\r
+ * \ingroup TortoiseMerge\r
+ * Handles the view and diff data a TortoiseMerge view needs.\r
+ */\r
+class CViewData\r
+{\r
+public:\r
+       CViewData(void);\r
+       ~CViewData(void);\r
+\r
+       void                    AddData(const CString& sLine, DiffStates state, int linenumber, EOL ending);\r
+       void                    AddData(const viewdata& data);\r
+       void                    InsertData(int index, const CString& sLine, DiffStates state, int linenumber, EOL ending);\r
+       void                    InsertData(int index, const viewdata& data);\r
+       void                    RemoveData(int index) {m_data.erase(m_data.begin() + index);}\r
+\r
+       const viewdata& GetData(int index) {return m_data[index];}\r
+       const CString&  GetLine(int index) {return m_data[index].sLine;}\r
+       DiffStates              GetState(int index) {return m_data[index].state;}\r
+       int                             GetLineNumber(int index) {return m_data.size() ? m_data[index].linenumber : 0;}\r
+       int                             FindLineNumber(int number);\r
+       EOL                             GetLineEnding(int index) {return m_data[index].ending;}\r
+\r
+       int                             GetCount() {return m_data.size();}\r
+\r
+       void                    SetState(int index, DiffStates state) {m_data[index].state = state;}\r
+       void                    SetLine(int index, const CString& sLine) {m_data[index].sLine = sLine;}\r
+       void                    SetLineNumber(int index, int linenumber) {m_data[index].linenumber = linenumber;}\r
+       void                    SetLineEnding(int index, EOL ending) {m_data[index].ending = ending;}\r
+\r
+       void                    Clear() {m_data.clear();}\r
+       void                    Reserve(int length) {m_data.reserve(length);}\r
+\r
+protected:\r
+       std::vector<viewdata>           m_data;\r
+};\r