/** * Copyright 2017 Matt Acosta * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Encoding } from './Encoding'; import { ISourceText } from './ISourceText'; import { ISourceTextContainer } from './ISourceTextContainer'; import { TextChange } from './TextChange'; import { TextSpan } from './TextSpan'; /** * Provides a base class for objects that contain source code. */ export declare abstract class SourceTextBase implements ISourceText, ISourceTextContainer { /** * @inheritDoc */ abstract readonly encoding: Encoding; /** * @inheritDoc */ abstract readonly length: number; /** * @inheritDoc */ abstract readonly sourceKey: ISourceText; /** * @inheritDoc */ abstract readonly sourceLength: number; /** * @inheritDoc */ abstract readonly sources: ReadonlyArray; /** * @inheritDoc */ abstract charCodeAt(offset: number): number; /** * @inheritDoc */ equals(value: ISourceText): boolean; /** * @inheritDoc */ abstract slice(position: TextSpan | number): ISourceText; /** * @inheritDoc */ abstract substring(start: number, length?: number): string; /** * @inheritDoc */ withChanges(changes: Iterable): ISourceText; /** * @inheritDoc */ abstract withEncoding(encoding: Encoding): ISourceText; /** * Determines if the given span is within the source text. * * @param {TextSpan} span * The span being checked. */ protected isSpanInText(span: TextSpan): boolean; }