The Pedigree Project
0.1
src
system
include
pedigree
kernel
debugger
commands
DevicesCommand.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef DEVICESCOMMAND_H
21
#define DEVICESCOMMAND_H
22
23
#include "pedigree/kernel/debugger/DebuggerCommand.h"
24
#include "pedigree/kernel/debugger/DebuggerIO.h"
25
#include "pedigree/kernel/debugger/Scrollable.h"
26
#include "pedigree/kernel/processor/state_forward.h"
27
#include "pedigree/kernel/processor/types.h"
28
#include "pedigree/kernel/utilities/StaticString.h"
29
#include "pedigree/kernel/utilities/Vector.h"
30
#include "pedigree/kernel/utilities/new"
31
32
class
Device
;
33
42
class
DevicesCommand
:
public
DebuggerCommand
{
43
public
:
47
DevicesCommand
();
48
52
~DevicesCommand
();
53
57
void
autocomplete
(
const
HugeStaticString
& input,
HugeStaticString
& output);
58
62
bool
execute
(
const
HugeStaticString
& input,
HugeStaticString
& output, InterruptState& state,
63
DebuggerIO
* screen);
64
68
const
NormalStaticString
getString
() {
69
return
NormalStaticString
(
"devices"
);
70
}
71
72
private
:
73
class
DeviceTree
:
public
Scrollable
{
74
public
:
75
DeviceTree
();
76
~DeviceTree
() {}
77
const
char
* getLine1(
size_t
index,
DebuggerIO::Colour
& colour,
DebuggerIO::Colour
& bgColour);
78
const
char
* getLine2(
size_t
index,
size_t
& colOffset,
DebuggerIO::Colour
& colour,
79
DebuggerIO::Colour
& bgColour);
80
size_t
getLineCount();
81
Device
* getDevForIndex(
size_t
index);
82
size_t
m_Line;
83
84
private
:
85
void
probeDev(
Device
* pDev);
86
Vector<Device*>
m_LinearTree;
87
};
88
89
class
DeviceInfo
:
public
Scrollable
{
90
public
:
91
DeviceInfo
();
92
~DeviceInfo
() {}
93
void
setDevice(
Device
* dev);
94
Device
* getDevice() {
95
return
m_pDev;
96
}
97
const
char
* getLine1(
size_t
index,
DebuggerIO::Colour
& colour,
DebuggerIO::Colour
& bgColour);
98
const
char
* getLine2(
size_t
index,
size_t
& colOffset,
DebuggerIO::Colour
& colour,
99
DebuggerIO::Colour
& bgColour);
100
size_t
getLineCount();
101
102
private
:
103
Device
* m_pDev;
104
DeviceInfo
(
const
DeviceInfo
&);
105
void
operator=(
const
DeviceInfo
&);
106
};
107
108
void
drawBackground(
size_t
nLines,
DebuggerIO
* pScreen);
109
};
110
113
#endif
DebuggerCommand
Definition
DebuggerCommand.h:37
DebuggerIO
Definition
DebuggerIO.h:49
DebuggerIO::Colour
Colour
Definition
DebuggerIO.h:54
Device
Definition
Device.h:41
DevicesCommand::DeviceInfo
Definition
DevicesCommand.h:89
DevicesCommand::DeviceTree
Definition
DevicesCommand.h:73
DevicesCommand
Definition
DevicesCommand.h:42
DevicesCommand::DevicesCommand
DevicesCommand()
Definition
DevicesCommand.cc:26
DevicesCommand::execute
bool execute(const HugeStaticString &input, HugeStaticString &output, InterruptState &state, DebuggerIO *screen)
Definition
DevicesCommand.cc:32
DevicesCommand::autocomplete
void autocomplete(const HugeStaticString &input, HugeStaticString &output)
Definition
DevicesCommand.cc:30
DevicesCommand::~DevicesCommand
~DevicesCommand()
Definition
DevicesCommand.cc:28
DevicesCommand::getString
const NormalStaticString getString()
Definition
DevicesCommand.h:68
Scrollable
Definition
Scrollable.h:29
StaticString
Definition
StaticString.h:49
Vector
A vector / dynamic array.
Definition
Vector.h:33
Generated on Sat Oct 3 2026 06:38:07 for The Pedigree Project by
1.9.8