129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.ITextStore;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17
|
|
18 /**
|
|
19 * Interface for storing and managing text.
|
|
20 * <p>
|
|
21 * Provides access to the stored text and allows to manipulate it.</p>
|
|
22 * <p>
|
|
23 * Clients may
|
|
24 * implement this interface or use {@link dwtx.jface.text.GapTextStore} or
|
|
25 * {@link dwtx.jface.text.CopyOnWriteTextStore}.</p>
|
|
26 */
|
|
27 public interface ITextStore {
|
|
28
|
|
29 /**
|
|
30 * Returns the character at the specified offset.
|
|
31 *
|
|
32 * @param offset the offset in this text store
|
|
33 * @return the character at this offset
|
|
34 */
|
|
35 char get(int offset);
|
|
36
|
|
37 /**
|
|
38 * Returns the text of the specified character range.
|
|
39 *
|
|
40 * @param offset the offset of the range
|
|
41 * @param length the length of the range
|
|
42 * @return the text of the range
|
|
43 */
|
|
44 String get(int offset, int length);
|
|
45
|
|
46 /**
|
|
47 * Returns number of characters stored in this text store.
|
|
48 *
|
|
49 * @return the number of characters stored in this text store
|
|
50 */
|
|
51 int getLength();
|
|
52
|
|
53 /**
|
|
54 * Replaces the specified character range with the given text.
|
|
55 * <code>replace(getLength(), 0, "some text")</code> is a valid
|
|
56 * call and appends text to the end of the text store.
|
|
57 *
|
|
58 * @param offset the offset of the range to be replaced
|
|
59 * @param length the number of characters to be replaced
|
|
60 * @param text the substitution text
|
|
61 */
|
|
62 void replace(int offset, int length, String text);
|
|
63
|
|
64 /**
|
|
65 * Replace the content of the text store with the given text.
|
|
66 * Convenience method for <code>replace(0, getLength(), text</code>.
|
|
67 *
|
|
68 * @param text the new content of the text store
|
|
69 */
|
|
70 void set(String text);
|
|
71 }
|