subclasses, though they don't do much yet. SourceCode is now associated with a SourceLanguage. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31544 a95241bf-73f2-0310-859d-f6bbb57e9c96
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
/*
|
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef FILE_SOURCE_CODE_H
|
|
#define FILE_SOURCE_CODE_H
|
|
|
|
|
|
#include <Locker.h>
|
|
|
|
|
|
#include "Array.h"
|
|
#include "SourceCode.h"
|
|
|
|
|
|
class LocatableFile;
|
|
class SourceFile;
|
|
|
|
|
|
class FileSourceCode : public SourceCode {
|
|
public:
|
|
FileSourceCode(LocatableFile* file,
|
|
SourceFile* sourceFile,
|
|
SourceLanguage* language);
|
|
virtual ~FileSourceCode();
|
|
|
|
status_t Init();
|
|
status_t AddSourceLocation(
|
|
const SourceLocation& location);
|
|
|
|
virtual bool Lock();
|
|
virtual void Unlock();
|
|
|
|
virtual SourceLanguage* GetSourceLanguage() const;
|
|
|
|
virtual int32 CountLines() const;
|
|
virtual const char* LineAt(int32 index) const;
|
|
|
|
virtual bool GetStatementLocationRange(
|
|
const SourceLocation& location,
|
|
SourceLocation& _start,
|
|
SourceLocation& _end) const;
|
|
|
|
virtual LocatableFile* GetSourceFile() const;
|
|
|
|
private:
|
|
int32 _FindSourceLocationIndex(
|
|
const SourceLocation& location,
|
|
bool& _foundMatch) const;
|
|
|
|
private:
|
|
BLocker fLock;
|
|
LocatableFile* fFile;
|
|
SourceFile* fSourceFile;
|
|
SourceLanguage* fLanguage;
|
|
Array<SourceLocation> fSourceLocations;
|
|
};
|
|
|
|
|
|
#endif // FILE_BASED_SOURCE_CODE_H
|