diff dwtx/jface/text/source/ILineDiffInfo.d @ 129:eb30df5ca28b

Added JFace Text sources
author Frank Benoit <benoit@tionex.de>
date Sat, 23 Aug 2008 19:10:48 +0200
parents
children c4fb132a086c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/text/source/ILineDiffInfo.d	Sat Aug 23 19:10:48 2008 +0200
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.text.source.ILineDiffInfo;
+
+import dwt.dwthelper.utils;
+
+
+/**
+ * Describes the change state of one line, which consists of the state of the line itself, which
+ * can be <code>UNCHANGED</code>, <code>CHANGED</code> or <code>ADDED</code>, and the number of
+ * deleted lines before and after this line.
+ * <p>
+ * This interface may be implemented by clients.
+ * </p>
+ *
+ * @since 3.0
+ */
+public interface ILineDiffInfo {
+
+    /** Denotes an unchanged line. */
+    static final int UNCHANGED= 0;
+
+    /** Denotes an added line. */
+    static final int ADDED= 1;
+
+    /** Denotes a changed line. */
+    static final int CHANGED= 2;
+
+    /**
+     * Returns the number of deleted lines after this line.
+     *
+     * @return the number of lines after this line.
+     */
+    int getRemovedLinesBelow();
+
+    /**
+     * Returns the number of deleted lines before this line.
+     *
+     * @return the number of lines before this line.
+     */
+    int getRemovedLinesAbove();
+
+    /**
+     * Returns the type of this line, one out of <code>UNCHANGED</code>, <code>CHANGED</code> or
+     * <code>ADDED</code>.
+     *
+     * @return the type of this line.
+     */
+    int getChangeType();
+
+    /**
+     * Returns whether this line has any changes (to itself, or any deletions before or after it).
+     *
+     * @return <code>true</code>, if the line's state (as returned by <code>getType</code>) is
+     * either <code>CHANGED</code> or <code>ADDED</code> or either of <code>getRemovedLinesBelow</code>
+     * and <code>getRemovedLinesAbove</code> would return a number &gt; 0
+     */
+    bool hasChanges();
+
+    /**
+     * Returns the original text of this changed region
+     *
+     * @return the original text of this changed region, including any deleted lines. The returned
+     * value and its elements may not be <code>null/code>, it may however be of zero length
+     */
+    String[] getOriginalText();
+}