tracesrv/tracecompiler/src/com.nokia.tracecompiler/src/com/nokia/tracecompiler/source/SourceDocumentInterface.java
changeset 56 aa2539c91954
parent 41 838cdffd57ce
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 * Source document abstraction
       
    17 *
       
    18 */
       
    19 package com.nokia.tracecompiler.source;
       
    20 
       
    21 /**
       
    22  * Source document abstraction
       
    23  * 
       
    24  */
       
    25 public interface SourceDocumentInterface {
       
    26 
       
    27 	/**
       
    28 	 * Gets the property provider interface. This can return null if the
       
    29 	 * document framework does not support source properties
       
    30 	 * 
       
    31 	 * @return the property provider
       
    32 	 */
       
    33 	public SourcePropertyProvider getPropertyProvider();
       
    34 
       
    35 	/**
       
    36 	 * Gets a subset of document data
       
    37 	 * 
       
    38 	 * @param start
       
    39 	 *            the start offset
       
    40 	 * @param length
       
    41 	 *            the data length
       
    42 	 * @return the data
       
    43 	 * @throws SourceParserException
       
    44 	 *             if parameters are not valid
       
    45 	 */
       
    46 	public String get(int start, int length) throws SourceParserException;
       
    47 
       
    48 	/**
       
    49 	 * Gets a character
       
    50 	 * 
       
    51 	 * @param offset
       
    52 	 *            the offset
       
    53 	 * @return the character
       
    54 	 * @throws SourceParserException
       
    55 	 *             if offset is not valid
       
    56 	 */
       
    57 	public char getChar(int offset) throws SourceParserException;
       
    58 
       
    59 	/**
       
    60 	 * Gets the data length
       
    61 	 * 
       
    62 	 * @return the length
       
    63 	 */
       
    64 	public int getLength();
       
    65 
       
    66 	/**
       
    67 	 * Maps an offset to line number
       
    68 	 * 
       
    69 	 * @param offset
       
    70 	 *            the offset
       
    71 	 * @return the line number
       
    72 	 * @throws SourceParserException
       
    73 	 *             if offset is not valid
       
    74 	 */
       
    75 	public int getLineOfOffset(int offset) throws SourceParserException;
       
    76 
       
    77 	/**
       
    78 	 * Replaces data from the document
       
    79 	 * 
       
    80 	 * @param offset
       
    81 	 *            offset to removed data
       
    82 	 * @param length
       
    83 	 *            length of removed data
       
    84 	 * @param newText
       
    85 	 *            new data
       
    86 	 * @throws SourceParserException
       
    87 	 *             if parameters are not valid
       
    88 	 */
       
    89 	public void replace(int offset, int length, String newText)
       
    90 			throws SourceParserException;
       
    91 
       
    92 	/**
       
    93 	 * Adds a location to this source.
       
    94 	 * 
       
    95 	 * @param location
       
    96 	 *            the location to be added
       
    97 	 */
       
    98 	public void addLocation(SourceLocationInterface location);
       
    99 
       
   100 	/**
       
   101 	 * Removes a location from this source.
       
   102 	 * 
       
   103 	 * @param location
       
   104 	 *            the location to be removed
       
   105 	 */
       
   106 	public void removeLocation(SourceLocationInterface location);
       
   107 
       
   108 	/**
       
   109 	 * Gets the owner of this source
       
   110 	 * 
       
   111 	 * @return the owner
       
   112 	 */
       
   113 	public Object getOwner();
       
   114 
       
   115 	/**
       
   116 	 * Sets the owner of this source
       
   117 	 * 
       
   118 	 * @param owner
       
   119 	 *            the owner
       
   120 	 */
       
   121 	public void setOwner(Object owner);
       
   122 
       
   123 }