2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef FILE_SOURCE_CODE_H
6 #define FILE_SOURCE_CODE_H
13 #include "SourceCode.h"
20 class FileSourceCode
: public SourceCode
{
22 FileSourceCode(LocatableFile
* file
,
23 SourceFile
* sourceFile
,
24 SourceLanguage
* language
);
25 virtual ~FileSourceCode();
28 status_t
AddSourceLocation(
29 const SourceLocation
& location
);
32 virtual void Unlock();
34 virtual SourceLanguage
* GetSourceLanguage() const;
36 virtual bool GetStatementLocationRange(
37 const SourceLocation
& location
,
38 SourceLocation
& _start
,
39 SourceLocation
& _end
) const;
41 virtual LocatableFile
* GetSourceFile() const;
44 virtual int32
CountLines() const;
45 virtual const char* LineAt(int32 index
) const;
46 virtual int32
LineLengthAt(int32 index
) const;
49 int32
_FindSourceLocationIndex(
50 const SourceLocation
& location
,
51 bool& _foundMatch
) const;
56 SourceFile
* fSourceFile
;
57 SourceLanguage
* fLanguage
;
58 Array
<SourceLocation
> fSourceLocations
;
62 #endif // FILE_BASED_SOURCE_CODE_H