xref: /haiku/headers/private/debugger/model/Statement.h (revision fce4895d1884da5ae6fb299d23c735c598e690b1)
1*fce4895dSRene Gollent /*
2*fce4895dSRene Gollent  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3*fce4895dSRene Gollent  * Distributed under the terms of the MIT License.
4*fce4895dSRene Gollent  */
5*fce4895dSRene Gollent #ifndef STATEMENT_H
6*fce4895dSRene Gollent #define STATEMENT_H
7*fce4895dSRene Gollent 
8*fce4895dSRene Gollent #include <Referenceable.h>
9*fce4895dSRene Gollent 
10*fce4895dSRene Gollent #include "SourceLocation.h"
11*fce4895dSRene Gollent #include "TargetAddressRange.h"
12*fce4895dSRene Gollent #include "Types.h"
13*fce4895dSRene Gollent 
14*fce4895dSRene Gollent 
15*fce4895dSRene Gollent class Statement : public BReferenceable {
16*fce4895dSRene Gollent public:
17*fce4895dSRene Gollent 	virtual						~Statement();
18*fce4895dSRene Gollent 
19*fce4895dSRene Gollent 	virtual	SourceLocation		StartSourceLocation() const = 0;
20*fce4895dSRene Gollent 
21*fce4895dSRene Gollent 	virtual	TargetAddressRange	CoveringAddressRange() const = 0;
22*fce4895dSRene Gollent 
23*fce4895dSRene Gollent 	virtual	int32				CountAddressRanges() const = 0;
24*fce4895dSRene Gollent 	virtual	TargetAddressRange	AddressRangeAt(int32 index) const = 0;
25*fce4895dSRene Gollent 
26*fce4895dSRene Gollent 	virtual	bool				ContainsAddress(target_addr_t address)
27*fce4895dSRene Gollent 									const = 0;
28*fce4895dSRene Gollent };
29*fce4895dSRene Gollent 
30*fce4895dSRene Gollent 
31*fce4895dSRene Gollent class AbstractStatement : public Statement {
32*fce4895dSRene Gollent public:
33*fce4895dSRene Gollent 								AbstractStatement(const SourceLocation& start);
34*fce4895dSRene Gollent 
35*fce4895dSRene Gollent 	virtual	SourceLocation		StartSourceLocation() const;
36*fce4895dSRene Gollent 
37*fce4895dSRene Gollent protected:
38*fce4895dSRene Gollent 			SourceLocation		fStart;
39*fce4895dSRene Gollent };
40*fce4895dSRene Gollent 
41*fce4895dSRene Gollent 
42*fce4895dSRene Gollent class ContiguousStatement : public AbstractStatement {
43*fce4895dSRene Gollent public:
44*fce4895dSRene Gollent 								ContiguousStatement(const SourceLocation& start,
45*fce4895dSRene Gollent 									const TargetAddressRange& range);
46*fce4895dSRene Gollent 
AddressRange()47*fce4895dSRene Gollent 			const TargetAddressRange& AddressRange() const
48*fce4895dSRene Gollent 										{ return fRange; }
49*fce4895dSRene Gollent 
50*fce4895dSRene Gollent 	virtual	TargetAddressRange	CoveringAddressRange() const;
51*fce4895dSRene Gollent 
52*fce4895dSRene Gollent 	virtual	int32				CountAddressRanges() const;
53*fce4895dSRene Gollent 	virtual	TargetAddressRange	AddressRangeAt(int32 index) const;
54*fce4895dSRene Gollent 
55*fce4895dSRene Gollent 	virtual	bool				ContainsAddress(target_addr_t address) const;
56*fce4895dSRene Gollent 
57*fce4895dSRene Gollent protected:
58*fce4895dSRene Gollent 			TargetAddressRange	fRange;
59*fce4895dSRene Gollent };
60*fce4895dSRene Gollent 
61*fce4895dSRene Gollent 
62*fce4895dSRene Gollent #endif	// STATEMENT_H
63