1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef SOURCE_CODE_H 6#define SOURCE_CODE_H 7 8 9#include <Referenceable.h> 10 11#include "TargetAddressRange.h" 12 13 14class LocatableFile; 15class SourceLanguage; 16class SourceLocation; 17class Statement; 18 19 20class SourceCode : public BReferenceable { 21public: 22 virtual ~SourceCode(); 23 24 // Locking needed for GetStatementLocationRange(), since that might use 25 // mutable data. 26 virtual bool Lock() = 0; 27 virtual void Unlock() = 0; 28 29 virtual SourceLanguage* GetSourceLanguage() const = 0; 30 31 virtual int32 CountLines() const = 0; 32 virtual const char* LineAt(int32 index) const = 0; 33 virtual int32 LineLengthAt(int32 index) const = 0; 34 35 virtual bool GetStatementLocationRange( 36 const SourceLocation& location, 37 SourceLocation& _start, 38 SourceLocation& _end) const = 0; 39 40 virtual LocatableFile* GetSourceFile() const = 0; 41}; 42 43 44#endif // SOURCE_CODE_H 45